Windows 10 default environment variables

Environment variables are a set of dynamic named values that can affect the way running processes will behave on a computer. The variables can be used both in scripts and on the command line. Environment variables makes it easy when certain standard directories and parameters need to be referenced but where the actual locations or names can vary from computer to computer.

This tutorial will show you a complete list of environment variables that can be used to reference standard directories and parameters in Windows 10.

VARIABLE WINDOWS 10
%ALLUSERSPROFILE% C:\ProgramData
%APPDATA% C:\Users\{username}\AppData\Roaming
%CD% Current directory full path
(cmd only)
%CMDCMDLINE% Returns exact command line used to start current cmd.exe session.
(cmd only)
%CMDEXTVERSION% Number of current command processor extensions.
(cmd only)
%CommonProgramFiles% C:\Program Files\Common Files
%CommonProgramFiles(x86)% C:\Program Files (x86)\Common Files
%CommonProgramW6432% C:\Program Files\Common Files
%COMPUTERNAME% The computer name of the current local system.
%COMSPEC% C:\Windows\System32\cmd.exe
%DATE% Current date in format determined by Date command
(cmd only)
%ERRORLEVEL% Number defining exit status of previous command or program
(cmd only)
%HOMEDRIVE% C:\
%HOMEPATH% C:\Users\{username}
%LOCALAPPDATA% C:\Users\{username}\AppData\Local
%LOGONSERVER% \\{domain_logon_server}
\\MicrosoftAccount
%NUMBER_OF_PROCESSORS% 8
%OS% Windows_NT
%PATH%

C:\Windows;
C:\Windows\System32;
C:\Windows\System32\Wbem;
C:\Windows\System32\WindowsPowerShell\v1.0

%PathExt% .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
%PROCESSOR_ARCHITECTURE% AMD64
%PROCESSOR_IDENTIFIER% Intel64 Family 6 Model 158 Stepping 9, GenuineIntel
%PROCESSOR_LEVEL% 6
%PROCESSOR_REVISION% 9e09
%PROGRAMDATA% C:\ProgramData
%PROGRAMFILES% C:\Program Files
%ProgramW6432% C:\Program Files
%PROGRAMFILES(X86)% C:\Program Files (x86)
%PROMPT% Code for current command prompt format.
Code is usually $P$G
(cmd only)
%PSModulePath% C:\Windows\system32\WindowsPowerShell\v1.0\Modules\
%PUBLIC% C:\Users\Public
%RANDOM% To get random number between 0 and 32767
(cmd only)
%SessionName% When logging on directly to machine, returns "Console".

When client connects via terminal server session, is combination
of connection name, followed by pound symbol {#} and session number.

%SystemDrive% C:
%SystemRoot% C:\Windows
%TEMP% C:\Users\{username}\AppData\Local\Temp
%TMP% C:\Users\{username}\AppData\Local\Temp
%TIME% Current time in format determined by Time command
(cmd only)
%USERDOMAIN% The network domain name associated with the current user.
%USERDOMAIN_ROAMINGPROFILE% The network domain name associated with the current roaming profile.
%USERNAME% {username}
%USERPROFILE% C:\Users\{username}
%WINDIR% C:\Windows