Q: Common Windows Environment Variables

This is list of Windows Environment Variables. What are environment variables? Environment Variables are shortcuts to different parts of the Windows File Structure, they are mostly useful at the command line or batch scripts.

VariableWindows 2000/XPWindows Vista/7/8
%ALLUSERSPROFILE%C:\Documents and Settings\All UsersC:\ProgramData
%APPDATA%C:\Documents and Settings\{username}\Application DataC:\Users\{username}\AppData\Roaming
%CommonProgramFiles%C:\Program Files\Common FilesC:\Program Files\Common Files
%COMMONPROGRAMFILES(x86)%C:\Program Files (x86)\Common FilesC:\Program Files (x86)\Common Files
%COMPUTERNAME%(Computer Name)(Computer Name)
%COMSPEC%C:\Windows\System32\cmd.exeC:\Windows\System32\cmd.exe
%HOMEDRIVE%C:C:
%HOMEPATH%C:\Documents and Settings\{username}C:\Users\{username}
%LOCALAPPDATA%N/aC:\Users\{username}\AppData\Local
%LOGONSERVER%\\{domain_logon_server}\\{domain_logon_server}
%PATH%System PathSystem Path
%PATHEXT%.COM; .EXE; .BAT; .CMD; .VBS; .VBE; .JS ; .WSF; .WSH;.COM; .EXE; .BAT; .CMD; .VBS; .VBE; .JS ; .WSF; .WSH; .MSC
%ProgramData%N/aC:\ProgramData
%ProgramFiles%C:\Program FilesC:\Program Files
%ProgramFiles(x86)%C:\Program Files (x86)C:\Program Files (x86)
%PROMPT%Code for current command prompt format,usually $P$GCode for current command prompt format,usually $P$G
%Public%N/aC:\Users\Public
%SYSTEMDRIVE%C:C:
%SYSTEMROOT%C:\WindowsC:\Windows
%TEMP% and %TMP%C:\Documents and Settings\{username}\Local Settings\TempC:\Users\{Username}\AppData\Local\Temp
%USERDOMAIN%Connected Domain ControllerConnected Domain Controller
%USERNAME%UsernameUsername
%USERPROFILE%%SystemDrive%\Documents and Settings\{username}%SystemDrive%\Users\{username}
%WinDir%C:\WindowsC:\Windows
%CD%Current PathCurrent Path
%Time%(See Note)This variable points to the current time. The time is displayed according to the current user’s time format preferences.
%Random%(See Note) This variable returns a random number between 0 and 32767.

Know of any that I missed? Share them in the comments.

Sources

Last updated on

Comments

Be the first to comment on this Article

Leave a Comment

Support Options

On Premise Support

Need help in your home or office? No problem, we can come to you!

Learn More

Remote Support

Do you need assistants, but your too busy? Then Remote Support is the Best Option!

Learn More

Get Help Online

Need help right now? Then the forums are the best place for immediate help.

Forums

Polls

How often do you replace your primary computer?

View Results

Loading ... Loading ...