微軟的%%路徑

參考自 https://ss64.com/nt/syntax-variables.html

Standard (built-in) Environment Variables

VariableVolatile
(Read-Only)
Default value assuming the system drive is C:
ALLUSERSPROFILE C:\ProgramData
APPDATA C:\Users\{username}\AppData\Roaming
CDYThe current directory (string).
ClientNameYTerminal servers only – the ComputerName of a remote host.
CMDEXTVERSIONYThe current Command Processor Extensions version number. (NT = “1”, Win2000+ = “2”.)
CMDCMDLINEYThe original command line that invoked the Command Processor.
CommonProgramFiles C:\Program Files\Common Files
COMMONPROGRAMFILES(x86) C:\Program Files (x86)\Common Files
COMPUTERNAME {computername}
COMSPEC C:\Windows\System32\cmd.exe or if running a 32 bit WOW – C:\Windows\SysWOW64\cmd.exe
DATEYThe current date using same region specific format as DATE.
ERRORLEVELYThe current ERRORLEVEL value, automatically set when a program exits.
FPS_BROWSER_APP_PROFILE_STRING
FPS_BROWSER_USER_PROFILE_STRING
 Internet Explorer
Default
These are undocumented variables for the Edge browser in Windows 10.
HighestNumaNodeNumberY (hidden)The highest NUMA node number on this computer.
HOMEDRIVEYC:
HOMEPATHY\Users\{username}
LOCALAPPDATA C:\Users\{username}\AppData\Local
LOGONSERVER \\{domain_logon_server}
NUMBER_OF_PROCESSORSYThe Number of processors running on the machine.
OSYOperating system on the user’s workstation.
PATHUser and
System
C:\Windows\System32\;C:\Windows\;C:\Windows\System32\Wbem;{plus program paths}
PATHEXT.COM; .EXE; .BAT; .CMD; .VBS; .VBE; .JS ; .WSF; .WSH; .MSC
Determine the default executable file extensions to search for and use, and in which order, left to right.
The syntax is like the PATH variable – semicolon separators.
PROCESSOR_ARCHITECTUREYAMD64/IA64/x86 This doesn’t tell you the architecture of the processor but only of the current process, so it returns “x86” for a 32 bit WOW process running on 64 bit Windows. See detecting OS 32/64 bit
PROCESSOR_ARCHITEW6432 =%PROCESSOR_ARCHITECTURE% (but only available to 64 bit processes)
PROCESSOR_IDENTIFIERYProcessor ID of the user’s workstation.
PROCESSOR_LEVELYProcessor level of the user’s workstation.
PROCESSOR_REVISIONYProcessor version of the user’s workstation.
ProgramW6432 =%ProgramFiles%(but only available when running under a 64 bit OS)
ProgramData C:\ProgramData
ProgramFiles C:\Program Files or C:\Program Files (x86)
ProgramFiles(x86) 1 C:\Program Files (x86)   (but only available when running under a 64 bit OS)
PROMPT Code for current command prompt format,usually $P$G
C:>
PSModulePath %SystemRoot%\system32\WindowsPowerShell\v1.0\Modules\
Public C:\Users\Public
RANDOMYA random integer number, anything from 0 to 32,767 (inclusive).
%SessionName% Terminal servers only – for a terminal server session, SessionName is a combination of the connection name, followed by #SessionNumber. For a console session, SessionName returns “Console”.
SYSTEMDRIVE C:
SYSTEMROOT By default, Windows is installed to C:\Windows but there’s no guarantee of that, Windows can be installed to a different folder, or a different drive letter.
systemroot is a read-only system variable that will resolve to the correct location.
Defaults in early Windows versions are C:\WINNT, C:\WINNT35 and C:\WTSRV
TEMP and TMPUser VariableC:\Users\{Username}\AppData\Local\Temp
Under XP this was \{username}\Local Settings\Temp
TIMEYThe current time using same format as TIME.
UserDnsDomainY
User Variable
Set if a user is a logged on to a domain and returns the fully qualified DNS domain that the currently logged on user’s account belongs to.
USERDOMAIN {userdomain}
USERDOMAIN_roamingprofile The user domain for RDS or standard roaming profile paths. Windows 8/10/2012 (or Windows 7/2008 with Q2664408)
USERNAME {username}
USERPROFILE %SystemDrive%\Users\{username}
This is equivalent to the $HOME environment variable in Unix/Linux
WINDIR %windir% is a regular User variable and can be changed, which makes it less robust than %SystemRoot%
Set by default as windir=%SystemRoot%
%WinDir% pre-dates Windows NT, its use in many places has been replaced by the system variable: %SystemRoot%

1 Only on 64 bit systems, is used to store 32 bit programs.

Unless stated otherwise, all the variables above are System variables

Environment variables are stored in the registry:

User Variables: HKEY_CURRENT_USER\Environment
System Variables: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment

By default, files stored under Local Settings do not roam with a roaming profile.

Dynamic environment variables are read-only and are computed each time the variable is expanded. When all variables are listed with SET, these will not appear in the list. Do not attempt to directly SET a dynamic variable. 

Shell variables

Variables for current shell session are created with the SET command and are available only to the current CMD shell. These are only stored in memory not the registry. Shell variables are destroyed when the current shell (CMD) exits.

Running the SET command with no options will display all shell variables but also all User and System environment variables.

If the SET command is used to modify the PATH, or if it is removed completely with PATH ; that will not affect any other programs or CMD sessions opened before or after the current one.

發佈留言