Windows磁盘路径系统变量

使用系统变量比使用绝对路径更安全(注意WinXP和后面的系统有不同之处)。

Variable Locale specific Windows XP (CMD) Windows Vista/7/8 (CMD)
 %ALLUSERSPROFILE%[7] Yes C:\Documents and Settings\All Users C:\ProgramData[7]
 %APPDATA%[7] Yes C:\Documents and Settings\{username}\Application Data C:\Users\{username}\AppData\Roaming[7]
 %CommonProgramFiles%[7] Yes C:\Program Files\Common Files C:\Program Files\Common Files[7]
 %CommonProgramFiles(x86)%[7] Yes C:\Program Files (x86)\Common Files (only in 64-bit version) C:\Program Files (x86)\Common Files (only in 64-bit version)[7]
 %CommonProgramW6432%[7] Yes  %CommonProgramW6432% (not supported, not replaced by any value) C:\Program Files\Common Files (only in 64-bit version)[7]
 %COMPUTERNAME% No {computername} {computername}
 %ComSpec% No C:\Windows\System32\cmd.exe C:\Windows\System32\cmd.exe
 %HOMEDRIVE%[7] No C: C:[7]
 %HOMEPATH%[7] Yes \Documents and Settings\{username} \Users\{username}[7]
 %LOCALAPPDATA%[7] Yes  %LOCALAPPDATA% (not supported, not replaced by any value) C:\Users\{username}\AppData\Local[7]
 %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%[7] Yes  %ProgramData% (not supported, not replaced by any value)  %SystemDrive%\ProgramData[7]
 %ProgramFiles%[7] Yes  %SystemDrive%\Program Files  %SystemDrive%\Program Files[7]
 %ProgramFiles(x86)%[7] Yes  %SystemDrive%\Program Files (x86) (only in 64-bit version)  %SystemDrive%\Program Files (x86) (only in 64-bit version)[7]
 %ProgramW6432%[7] Yes  %ProgramW6432% (not supported, not replaced by any value)  %SystemDrive%\Program Files (only in 64-bit version)[7]
 %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%[7] Yes  %PUBLIC% (not supported, not replaced by any value)  %SystemDrive%\Users\Public[7]
 %SystemDrive%[7] No C: C:[7]
 %SystemRoot%[7] No The Windows directory, usually C:\Windows, formerly C:\WINNT  %SystemDrive%\Windows[7]
 %TEMP%[7] and %TMP%[7] Yes  %SystemDrive%\Documents and Settings\{username}\Local Settings\Temp  %SystemRoot%\TEMP (for system environment variables %TMP% and %TEMP%), %USERPROFILE%\AppData\Local\Temp\AppData\Local\Temp[7] (for user environment variables %TMP% and %TEMP%)
 %USERDOMAIN% No {userdomain} {userdomain}
 %USERNAME% No {username} {username}
 %USERPROFILE%[7] Yes  %SystemDrive%\Documents and Settings\{username}  %SystemDrive%\Users\{username}[7]
 %windir%[7] No  %SystemDrive%\WINDOWS  %SystemDrive%\Windows[7]

 

https://en.wikipedia.org/wiki/Environment_variable

Add a Comment

电子邮件地址不会被公开。 必填项已用*标注

10 + 11 =