Where are my environment variables set on Vista32?

前提是你 提交于 2019-12-11 23:31:56

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/5146526/where-are-my-environment-variables-set-on-vista32

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!