Windows: Predefined Environmental Variables

Registry key for system variables:

HKEY_LOCAL_MACHINE\ SYSTEM\ CurrentControlSet\ Control\ Session Manager\
%SystemDrive% = C:
%SystemRoot%
= C:\WINDOWS
%WinDir%
= C:\WINDOWS
%SystemDirectory%
= C:\WINDOWS\System32
%ComSpec%
= C:\WINDOWS\system32\cmd.exe
%programfiles%
= C:\WINDOWS\Program Files
%Temp%
(or %Tmp%) = C:\Users\<USERNAME>\AppData\Local\Temp or C:\DOCUME~1\<USERNAME>\LOCALS~1\Temp
%HOMEDRIVE%
= C:
%HOMEPATH%
= C:\Users\<USERNAME> or C:\Documents and Settings\<USERNAME>
%OS%
= The operating system you are running
%USERDOMAIN%

%USERNAME%
%USERPROFILE%
= C:\Users\<USERNAME> or C:\Documents and Settings\<USERNAME>
%USERPROFILE%\Desktop
= C:\Users\<USERNAME>\Desktop or C:\Documents and Settings\<USERNAME>\Desktop
%CD%
= The current directory
%DATE%
= Current date in the format set by the Date command
%TIME%
= Current time in the format set by the Time command
%ERRORLEVEL%
= A number defining exit status of a previous command or called executable
%RANDOM%
= A random number between 0 and 32767

Registry key for user variables:

HKEY_CURRENT_USER\Environment

Leave a Reply