Skip to content

Instantly share code, notes, and snippets.

@pkfrom
Last active January 11, 2024 15:12
Show Gist options
  • Star 23 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
  • Save pkfrom/f6eb82316b725a51f357 to your computer and use it in GitHub Desktop.
Save pkfrom/f6eb82316b725a51f357 to your computer and use it in GitHub Desktop.
List of Environment Variables in Windows Operating System.

List of Environment Variables in Windows Operating System

Windows XP Environment Variables

Environment Variable Path
%ALLUSERSPROFILE% C:\Documents and Settings\All Users
%APPDATA% C:\Documents and Settings{username}\Application Data
%COMMONPROGRAMFILES% C:\Program Files\Common Files
%COMMONPROGRAMFILES(x86)% C:\Program Files (x86)\Common Files
%COMSPEC% C:\Windows\System32\cmd.exe
%HOMEDRIVE% C:
%HOMEPATH% C:\Documents and Settings{username}
%PROGRAMFILES% C:\Program Files
%PROGRAMFILES(X86)% C:\Program Files (x86) (only in 64-bit version)
%SystemDrive% C:
%SystemRoot% C:\Windows
%TEMP% and %TMP% C:\Documents and Settings{username}\Local Settings\Temp
%USERPROFILE% C:\Documents and Settings{username}
%WINDIR% C:\Windows

Windows Vista and Later

Environment Variable Path
%ALLUSERSPROFILE% C:\ProgramData
%APPDATA% C:\Users{username}\AppData\Roaming
%COMMONPROGRAMFILES% C:\Program Files\Common Files
%COMMONPROGRAMFILES(x86)% C:\Program Files (x86)\Common Files
%COMSPEC% C:\Windows\System32\cmd.exe
%HOMEDRIVE% C:
%HOMEPATH% C:\Users{username}
%LOCALAPPDATA% C:\Users{username}\AppData\Local
%PROGRAMDATA% C:\ProgramData
%PROGRAMFILES% C:\Program Files
%PROGRAMFILES(X86)% C:\Program Files (x86) (only in 64-bit version)
%PUBLIC% C:\Users\Public
%SystemDrive% C:
%SystemRoot% C:\Windows
%TEMP% and %TMP% C:\Users{username}\AppData\Local\Temp
%USERPROFILE% C:\Users{username}
%WINDIR% C:\Windows
%SystemDirectory% C:\WINDOWS\System32

More

Environment Variable Detail
%CD% The current directory.
%ERRORLEVEL% A number defining exit status of a previous command or called executable.
%OS% The operating system the user is running
%USERDOMAIN% The name of the domain that contains the user's account
%USERNAME% The user's name
%DATE% Current date in the format
%TIME% Current time in the format
%RANDOM% A random number between 0 and 32767.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment