Variable | Locale specific | Windows XP (CMD) | Windows Vista/7/8 (CMD) |
%ALLUSERSPROFILE% | Yes | C:\Documents and Settings\All Users | C:\ProgramData |
%APPDATA% | Yes | C:\Documents and Settings\{username}\Application Data | C:\Users\{username}\AppData\Roaming |
%CommonProgramFiles% | Yes | C:\Program Files\Common Files | C:\Program Files\Common Files |
%CommonProgramFiles(x86)% | Yes | C:\Program Files (x86)\Common Files (only in 64-bit version) | C:\Program Files (x86)\Common Files (only in 64-bit version) |
%CommonProgramW6432% | Yes | %CommonProgramW6432% (not supported, not replaced by any value) | C:\Program Files\Common Files (only in 64-bit version) |
%COMPUTERNAME% | No | {computername} | {computername} |
%ComSpec% | No | C:\Windows\System32\cmd.exe | C:\Windows\System32\cmd.exe |
%HOMEDRIVE% | No | C: | C: |
%HOMEPATH% | Yes | \Documents and Settings\{username} | \Users\{username} |
%LOCALAPPDATA% | Yes | %LOCALAPPDATA% (not supported, not replaced by any value) | C:\Users\{username}\AppData\Local |
%LOGONSERVER% | No | \\{domain_logon_server} | \\{domain_logon_server} |
%PATH% | Yes | C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;{plus program paths} | C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;{plus program paths} |
%PATHEXT% | No | .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.WSF;.WSH | .com;.exe;.bat;.cmd;.vbs;.vbe;.js;.jse;.wsf;.wsh;.msc |
%ProgramData% | Yes | %ProgramData% (not supported, not replaced by any value) | %SystemDrive%\ProgramData |
%ProgramFiles% | Yes | %SystemDrive%\Program Files | %SystemDrive%\Program Files |
%ProgramFiles(x86)% | Yes | %SystemDrive%\Program Files (x86) (only in 64-bit version) | %SystemDrive%\Program Files (x86) (only in 64-bit version) |
%ProgramW6432% | Yes | %ProgramW6432% (not supported, not replaced by any value) | %SystemDrive%\Program Files (only in 64-bit version) |
%PROMPT% | No | Code for current command prompt format, usually $P$G | Code for current command prompt format, usually $P$G |
%PSModulePath% | %PSModulePath% (not supported, not replaced by any value) | %SystemRoot%\system32\WindowsPowerShell\v1.0\Modules\ | |
%PUBLIC% | Yes | %PUBLIC% (not supported, not replaced by any value) | %SystemDrive%\Users\Public |
%SystemDrive% | No | C: | C: |
%SystemRoot% | No | The Windows directory, usually C:\Windows, formerly C:\WINNT | %SystemDrive%\Windows |
%TEMP% and %TMP% | Yes | %SystemDrive%\Documents and Settings\{username}\Local Settings\Temp | %SystemRoot%\TEMP (for system environment variables %TMP% and %TEMP%), %USERPROFILE%\AppData\Local\Temp(for user environment variables %TMP% and %TEMP%) |
%USERDOMAIN% | No | {userdomain} | {userdomain} |
%USERNAME% | No | {username} | {username} |
%USERPROFILE% | Yes | %SystemDrive%\Documents and Settings\{username} | %SystemDrive%\Users\{username} |
%windir% | No | %SystemDrive%\WINDOWS | %SystemDrive%\Windows |
1、查看当前所有可用的环境变量:输入 set 即可查看。
2、查看某个环境变量:输入 “set 变量名”即可,比如想查看path变量的值,即输入 set path
3、修改环境变量 :输入 “set 变量名=变量内容”即可,比如将path设置为“d:\nmake.exe”,只要输入set path="d:\nmake.exe"。注意,此修改环境变量是指用现在的内容去覆盖以前的内容,并不是追加。比如当我设置了上面的path路径之后,如果我再重新输入set path="c",再次查看path路径的时候,其值为“c:”,而不是“d:\nmake.exe”;“c”。
源文档:
https://en.wikipedia.org/wiki/Environment_variable
http://blog.csdn.net/catshitone/article/details/70238163
http://blog.csdn.net/wzsbll/article/details/6690895#comments
欢迎光临 无忧启动论坛 (http://bbs.c3.wuyou.net/) | Powered by Discuz! X3.3 |