Windows 10 上的环境变量的完整列表
使用这些环境变量快速浏览任何计算机上的 Windows 10 位置。
Windows 10 上,环境变量是预定义的名称,表示操作系统中某些位置的路径,例如驱动器或特定文件或文件夹。
环境变量在许多情况下都有用,但如果您是 IT 人员或正在修理其他人的计算机,它们尤其有用,因为您可以快速导航到某些位置,甚至不知道用户名或完整路径一个系统文件夹。

例如C:\Users\
在本指南中,您将了解可在Windows 10上使用的最常见环境变量的列表。
| Variable | Windows 10 |
|---|---|
| %ALLUSERSPROFILE% | C:\ProgramData |
| %APPDATA% | C:\Users\{username}\AppData\Roaming |
| %COMMONPROGRAMFILES% | C:\Program Files\Common Files |
| %COMMONPROGRAMFILES(x86)% | C:\Program Files (x86)\Common Files |
| %CommonProgramW6432% | C:\Program Files\Common Files |
| %COMSPEC% | C:\Windows\System32\cmd.exe |
| %HOMEDRIVE% | C:\ |
| %HOMEPATH% | C:\Users\{username} |
| %LOCALAPPDATA% | C:\Users\{username}\AppData\Local |
| %LOGONSERVER% | \\{domain_logon_server} |
| %PATH% | C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem |
| %PathExt% | .com;.exe;.bat;.cmd;.vbs;.vbe;.js;.jse;.wsf;.wsh;.msc |
| %PROGRAMDATA% | C:\ProgramData |
| %PROGRAMFILES% | C:\Program Files |
| %ProgramW6432% | C:\Program Files |
| %PROGRAMFILES(X86)% | C:\Program Files (x86) |
| %PROMPT% | $P$G |
| %SystemDrive% | C: |
| %SystemRoot% | C:\Windows |
| %TEMP% | C:\Users\{username}\AppData\Local\Temp |
| %TMP% | C:\Users\{username}\AppData\Local\Temp |
| %USERDOMAIN% | Userdomain associated with current user. |
| %USERDOMAIN_ROAMINGPROFILE% | Userdomain associated with roaming profile. |
| %USERNAME% | {username} |
| %USERPROFILE% | C:\Users\{username} |
| %WINDIR% | C:\Windows |
| %PUBLIC% | C:\Users\Public |
| %PSModulePath% | %SystemRoot%\system32\WindowsPowerShell\v1.0\Modules\ |
| %OneDrive% | C:\Users\{username}\OneDrive |
| %DriverData% | C:\Windows\System32\Drivers\DriverData |
| %CD% | Outputs current directory path. (Command Prompt.) |
| %CMDCMDLINE% | Outputs command line used to launch current Command Prompt session. (Command Prompt.) |
| %CMDEXTVERSION% | Outputs the number of current command processor extensions. (Command Prompt.) |
| %COMPUTERNAME% | Outputs the system name. |
| %DATE% | Outputs current date. (Command Prompt.) |
| %TIME% | Outputs time. (Command Prompt.) |
| %ERRORLEVEL% | Outputs the number of defining exit status of previous command. (Command Prompt.) |
| %PROCESSOR_IDENTIFIER% | Outputs processor identifier. |
| %PROCESSOR_LEVEL% | Outputs processor level. |
| %PROCESSOR_REVISION% | Outputs processor revision. |
| %NUMBER_OF_PROCESSORS% | Outputs the number of physical and virtual cores. |
| %RANDOM% | Outputs random number from 0 through 32767. |
| %OS% | Windows_NT |
虽然您可以使用环境变量来快速访问其中的某些位置windows 10,您通常会在构建脚本或应用程序时使用这些变量。
请记住,提到的一些变量不是特定于位置的,包括%COMPUTERNAME%, %PATHEXT%, %PROMPT%, %USERDOMAIN%, %USERNAME%。
相关文章
网友评论(共有 0 条评论)