Skip to content

Instantly share code, notes, and snippets.

@phts
Created September 30, 2014 15:42
Show Gist options
  • Save phts/b29717384440ffc814d7 to your computer and use it in GitHub Desktop.
Save phts/b29717384440ffc814d7 to your computer and use it in GitHub Desktop.
Windows Cmd environment variable list
> set
  • %SystemDrive% - C:
  • %SystemRoot% - C:\WINDOWS
  • %WinDir% - C:\WINDOWS
  • %SystemDirectory% - C:\WINDOWS\System32
  • %ComSpec% - The path including the command interpreter program (C:\WINDOWS\system32\cmd.exe)
  • %programfiles% - C:\WINDOWS\Program Files
  • %Temp%, %Tmp% - C:\Users\W\AppData\Local\Temp on Windows Vista & 2008
  • %HOMEDRIVE% - The drive letter associated with the user's home directory (C:)
  • %HOMEPATH% - The path to the user's home directory as defined in UMD/AD (excluding drive): (\Users<USERNAME> on Windows Vista & 2008)
  • %OS% - The operating system the user is running (Windows_NT (even on Windows Vista & XP machines))
  • %USERDOMAIN% - The name of the domain that contains the user's account. On a stand-alone machine, the same as the machine name.
  • %USERNAME% - The user's name
  • %USERPROFILE% - The user's root folder (C:\Users<USERNAME>)
  • %CD% - The current directory.
  • %DATE% - Current date in the format set by the Date command
  • %TIME% - Current time in the format set by the Time command
  • %ERRORLEVEL% - A number defining exit status of a previous command or called executable.
  • %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