This tutorial will show you a complete list of default environment variables that can be used to reference standard directories and parameters in Windows 10 and Windows 11.
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.
The variable (ex: "%UserProfile%" for command and "$Env:UserProfile" for PowerShell) is used as a type of shortcut of the value (ex: "C:\Users\<username>").
There are two types of environment variables: user environment variables (set only for current user) and system environment variables (set for all users).
User environment variables are stored in the registry key below:
HKEY_CURRENT_USER\Environment
System environment variables are stored in the registry key below:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment
You can open a command prompt, type set
, and press Enter to display all current environment variables on your PC.
You can open PowerShell, type Get-ChildItem Env:
, and press Enter to display all current environment variables on your PC.
Command Environment Variables | PowerShell Environment Variables | Values |
---|---|---|
%ALLUSERSPROFILE% | $Env:ALLUSERSPROFILE | C:\ProgramData |
%APPDATA% | $Env:APPDATA | C:\Users\(user-name)\AppData\Roaming |
%CD% | $Env:CD | Current directory full path |
%CMDCMDLINE% | Returns exact command line used to start current cmd.exe session. | |
%CMDEXTVERSION% | Number of current command processor extensions. | |
%CommonProgramFiles% | $Env:CommonProgramFiles | C:\Program Files\Common Files |
%CommonProgramFiles(x86)% | $Env:CommonProgramFiles(x86) | C:\Program Files (x86)\Common Files |
%CommonProgramW6432% | $Env:CommonProgramW6432 | C:\Program Files\Common Files |
%COMPUTERNAME% | $Env:COMPUTERNAME | The computer name of the current local system. |
%ComSpec% | $Env:ComSpec | C:\Windows\System32\cmd.exe |
%DATE% | Current date in format determined by Date command | |
%DriverData% | $Env:DriverData | C:\Windows\System32\Drivers\DriverData |
%ERRORLEVEL% | Number defining exit status of previous command or program | |
%HOMEDRIVE% | $Env:HOMEDRIVE | C: |
%HOMEPATH% | $Env:HOMEPATH | \Users\(user-name) |
%LOCALAPPDATA% | $Env:LOCALAPPDATA | C:\Users\(user-name)\AppData\Local |
%LOGONSERVER% | $Env:LOGONSERVER | \\MicrosoftAccount |
%NUMBER_OF_PROCESSORS% | $Env:NUMBER_OF_PROCESSORS | 12 |
%OneDrive% | $Env:OneDrive | Current OneDrive folder location |
%OS% | $Env:OS | Windows_NT |
%Path% | $Env:path | C:\WINDOWS C:\WINDOWS\system32 C:\WINDOWS\System32\Wbem C:\WINDOWS\System32\WindowsPowerShell\v1.0 |
%PATHEXT% | $Env:pATHEXT | COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC |
%PROCESSOR_ARCHITECTURE% | $Env:pROCESSOR_ARCHITECTURE | AMD64 |
%PROCESSOR_IDENTIFIER% | $Env:pROCESSOR_IDENTIFIER | Intel64 Family 6 Model 158 Stepping 10, GenuineIntel |
%PROCESSOR_LEVEL% | $Env:pROCESSOR_LEVEL | 6 |
%PROCESSOR_REVISION% | $Env:pROCESSOR_REVISION | 9e0a |
%ProgramData% | $Env:programData | C:\ProgramData |
%ProgramFiles% | $Env:programFiles | C:\Program Files |
%ProgramFiles(x86)% | $Env:programFiles(x86) | C:\Program Files (x86) |
%ProgramW6432% | $Env:programW6432 | C:\Program Files |
%PROMPT% | Code for current command prompt format. Code is usually $P$G | |
%PSModulePath% | $Env:pSModulePath | C:\Windows\system32\WindowsPowerShell\v1.0\Modules\ |
%PUBLIC% | $Env:pUBLIC | C:\Users\Public |
%RANDOM% | Get random number between 0 and 32767 | |
%SESSIONNAME% | $Env: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% | $Env:SystemDrive | C: |
%SystemRoot% | $Env:SystemRoot | C:\Windows |
%TEMP% | $Env:TEMP | C:\Users\(user-name)\AppData\Local\Temp |
%TIME% | Current time in format determined by Time command | |
%TMP% | $Env:TMP | C:\Users\(user-name)\AppData\Local\Temp |
%USERDOMAIN% | $Env:USERDOMAIN | Network domain name associated with the current user. |
%USERDOMAIN_ROAMINGPROFILE% | $Env:USERDOMAIN_ROAMINGPROFILE | Network domain name associated with the current roaming profile. |
%USERNAME% | $Env:USERNAME | (user-name) |
%USERPROFILE% | $Env:USERPROFILE | C:\Users\(user-name) |
%WINDIR% | $Env:WINDIR | C:\Windows |
That's it,
Shawn Brink
Related Tutorials
- Create New Environment Variables in Windows 11
- Delete Environment Variables in Windows 11
- Create Shortcuts to Open Control Panel Items in Windows 11
- Create Shortcuts to Open Pages in Settings in Windows 11
- List of Windows 11 CLSID Key (GUID) Shortcuts
- List of Windows 11 Shell Commands for Shell Folder Shortcuts
- Complete List of Rundll32 Commands in Windows 11
Attachments
Last edited: