What did I do to cause environment variables to change when I start the Windows command prompt?

Viewed 269

I am using Windows 10 x64. I have Anaconda3 installed. If I start C:\Windows\system32\cmd.exe with nothing else running (and nothing interesting in the background that I can see), the following is added to the front of my PATH variable that is not present in the Control Panel UI: C:\Users\me\Anaconda3\condabin\.

I also see some other environment variables added, which again are not present in the Control Panel UI:

CONDA_BAT=C:\Users\me\Anaconda3\condabin\conda.bat
CONDA_EXE=C:\Users\me\Anaconda3\Scripts\conda.exe
CONDA_SHLVL=0

In addition to not showing up in the control panel UI, the environment variables described above do not appear in the output when I run ls env: in powershell.

What could be causing this? I think it might be something I set up. I definitely like it, but I don't know what causes it or how to reproduce it. Any ideas?

In this question the answerer explains that this can be caused by launching cmd.exe from some other launcher; however, that's not what I'm doing.

1 Answers

Reddit user 4wh457 and SO user JosefZ solved my problem. It turns out that I created a registry key in HKEY_CURRENT_USER\Software\Microsoft\Command Processor with the following properties (in the RegCool interface):

  • NAME = AutoRun

  • Type = REG_EXPAND_SZ

  • Data = if exist "C:\Users\me\Anaconda3\condabin\conda_hook.bat" "C:\Users\me\Anaconda3\condabin\conda_hook.bat"

Per JosefZ, the AutoRun key could have also been here:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment

(further documentation here).

Related