By following:
Start -> Computer -> Right Click -> Properties -> Advanced System Settings -> Advanced -> Environment Variables
I find User variables for brianjd
(which includes TMP
and TEMP
) and System Variables
(which includes, Path
, USERNAME
, etc.). I would expect these variables to be set in C:\AUTOEXEC.BAT
or C:\CONFIG.SYS
. Instead, I find REM Dummy file for NTVDM
and FILES=40
in those files.
Q: Where are the files that actually set the environment variables with statements like SET USERNAME=brianjd
?
Q: When I follow the Windows GUI path above and add the variable name and value FOO
and C:\foo
to either User variables for brianjd
or System Variables
, what is actually happening? What is Windows writing to where?
The variables are not in a script file like /etc/environment on Linux, for example. Windows stores them in the registry. The keys are "HKCU\Environment" (user variables) and "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" (system-wide variables).
See also the relevant MSDN article.