SOLVED: What Are The Common Variables In Windows

Below is a complete list of Windows variables.  If you are writing any sort of script, PowerShell, or command line you will need to know:

  • The variable for username is %username%
  • The variable for the Windows Directory is %windir% or %systemroot%
  • The variable for Program Files is %ProgramFiles% or %ProgramFiles(x86)%
  • The variable for the current user profile is %UserProfile%

Below is a complete list of default variables.  You can add as many more variables as you like by right clicking on the START BUTTON, selecting SYSTEM, selecting ADVANCED, selecting ENVIRONMENT VARIABLES button.

 

Variable Localized Windows 10, 8, 7, Vista Path
%ALLUSERSPROFILE% Yes C:\ProgramData
%APPDATA% Yes C:\Users\<username>\AppData\Roaming
%CommonProgramFiles% Yes C:\Program Files\Common Files
%CommonProgramFiles(x86)% Yes C:\Program Files (x86)\Common Files (64-bit version)
%CommonProgramW6432% Yes C:\Program Files\Common Files (64-bit version)
%COMPUTERNAME% No <computername>
%ComSpec% No C:\Windows\System32\cmd.exe
%HOMEDRIVE% No C:
%HOMEPATH% Yes \Users\<username>
%LOCALAPPDATA% Yes C:\Users\<username>\AppData\Local
%LOGONSERVER% No \\<domain_logon_server>
%PATH% Yes C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;<installed program paths>
%PATHEXT% No .com;.exe;.bat;.cmd;.vbs;.vbe;.js;.jse;.wsf;.wsh;.msc
%ProgramData% Yes %SystemDrive%\ProgramData
%ProgramFiles% Yes %SystemDrive%\Program Files
%ProgramFiles(x86)% Yes %SystemDrive%\Program Files (x86)   (64-bit version)
%ProgramW6432% Yes %SystemDrive%\Program Files     (64-bit version)
%PROMPT% No Current command prompt format, usually $P$G
%PSModulePath% %SystemRoot%\system32\WindowsPowerShell\v1.0\Modules\
%PUBLIC% Yes %SystemDrive%\Users\Public
%SystemDrive% No C:
%SystemRoot% No %SystemDrive%\Windows
%TEMP% and %TMP% Yes %SystemRoot%\TEMP (system variables)  %USERPROFILE%\AppData\Local\Temp (user variables)
%USERDOMAIN% No <userdomain>
%USERNAME% No <username>
%USERPROFILE% Yes %SystemDrive%\Users\<username>
%windir% No %SystemDrive%\Windows

.
.

View Comments

This website uses cookies.