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.
Thevariable (ex: "%UserProfile%") is used as a type of shortcut of thevalue (ex: "C:\Users\<username>").
There are two types of environment variables:user environment variables (set only for current user) andsystem environment variables (set for all users).
This tutorial will show you a complete list of defaultenvironment variables that can be used to reference standard directories and parameters inWindows 10.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 acommand prompt, typeset, and pressEnter to display all current environment variables on your PC.
You can openPowerShell, typeGet-ChildItem Env:, and pressEnter to display all current environment variables on your PC.
%ALLUSERSPROFILE% C:\ProgramData %APPDATA% C:\Users\\AppData\Roaming %CD% (command prompt only) Current directory full path %CMDCMDLINE% (command prompt only) Returns exact command line used to start current cmd.exe session. %CMDEXTVERSION% (command prompt only) Number of current command processor extensions. %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% (command prompt only) Current date in format determined byDate command %DriverData% C:\Windows\System32\Drivers\DriverData %ERRORLEVEL% (command prompt only) Number defining exit status of previous command or program %HOMEDRIVE% C: %HOMEPATH% \Users\ %LOCALAPPDATA% C:\Users\\AppData\Local %LOGONSERVER% \\MicrosoftAccount %NUMBER_OF_PROCESSORS% %OneDrive% Current OneDrive folder location %OS% Windows_NT %PATH% %PATHEXT% %PROCESSOR_ARCHITECTURE% %PROCESSOR_IDENTIFIER% %PROCESSOR_LEVEL% %PROCESSOR_REVISION% %ProgramData% C:\ProgramData %ProgramFiles% C:\Program Files %ProgramFiles(x86)% C:\Program Files (x86) %ProgramW6432% C:\Program Files %PROMPT% (command prompt only) Code for current command prompt format. Code is usually %PSModulePath% C:\Windows\system32\WindowsPowerShell\v1.0\Modules\ %PUBLIC% C:\Users\Public %RANDOM% (command prompt only) To get random number between 0 and 32767 %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\\AppData\Local\Temp %TIME% (command prompt only) Current time in format determined byTime command %TMP% C:\Users\\AppData\Local\Temp %USERDOMAIN% The network domain name associated with the current user. %USERDOMAIN_ROAMINGPROFILE% The network domain name associated with the current roaming profile. %USERNAME% %USERPROFILE% C:\Users\ %WINDIR% C:\Windows
That's it,
Shawn BrinkRelated Tutorials
- How to Create Environment Variables Shortcut in Windows
- How to Add Environment Variables Context Menu in Windows 10
- How to Set New User and System Environment Variables in Windows
- How to Edit User and System Environment Variables in Windows
- How to Delete User and System Environment Variables in Windows
- Complete List of Windows 10 CLSID Key (GUID) Shortcuts
- Complete List of Windows 10 Shell Commands
- List of Rundll32 Commands for Windows 10
- List of Commands to Open Windows 10 Apps
- List of msi-settings URI Shortcuts to Open Settings Pages in Windows 10



Quote

