Simplicty and flexibility!

Windows Environment Variables (Complete List XP/WIndows 7/8)

Started by DataEase
You will need to Sign In to be able to comment on the Blog!

Windows Environment Variables (Complete List XP/WIndows 7/8)

Environment variables is very useful to make general code. You can include them in paths directly to access files native to an active user/workstation/profile/session etc.


System path variables refer to locations of critical operating system resources, and as such generally are not user-dependent.

Contains the full path to the Application Data directory of the logged-in user. Does not work on Windows NT 4.0 SP6 UK.
This variable is the temporary files of Applications. Its uses include storing of desktop themes, Windows error reporting, caching and profiles of web browsers.
The %ComSpec% variable contains the full path to the command processor; on Windows NT-based operating systems, this is CMD.EXE, while on Windows 9x and ME, %COMSPEC% is the DOS command processor, COMMAND.COM.
The %OS% variable contains a symbolic name of the operating system family to distinguish between differing feature sets in batchjobs. Under Windows NT, Windows 2000, Windows XPand Windows 7, it always holds the string "Windows_NT". It resembles an identically named environment variable %OS%"> found in all DOS-related operating systems of Digital Research-origin like Concurrent DOS, Multiuser DOS, REAL/32, DOS Plus, DR DOS, Novell DOS and OpenDOS.
This variable contains a semicolon-delimited (do not put spaces in between) list of directories in which the command interpreter will search for an executable file that matches the given command. Environment variables that represent paths may be nested within the %PATH% variable, but only at one level of indirection. If this sub-path environment variable itself contains an environment variable representing a path, %PATH% will not expand properly in the variable substitution. Equivalent to the Unix $PATH"> variable.
%ProgramFiles%, %ProgramFiles(x86)%, %ProgramW6432%
The %ProgramFiles% variable points to the Program Files directory, which stores all the installed programs of Windows and others. The default on English-language systems is "C:\Program Files". In 64-bit editions of Windows (XP, 2003, Vista), there are also %ProgramFiles(x86)%, which defaults to "C:\Program Files (x86)", and %ProgramW6432%, which defaults to "C:\Program Files". The %ProgramFiles% itself depends on whether the process requesting the environment variable is itself 32-bit or 64-bit (this is caused byWindows-on-Windows 64-bit redirection).
This variable points to the Common Files directory. The default is "C:\Program Files\Common Files" in the English version of Windows.
The %SystemDrive% variable is a special system-wide environment variable found on Windows NT and its derivatives. Its value is the drive upon which the system directory was placed. The value of %SystemDrive% is in most cases "C:".
The %SystemRoot% variable is a special system-wide environment variable found on Windows NT and its derivatives. Its value is the location of the system directory, including the drive and path. The drive is the same as %SystemDrive% and the default path on a clean installation depends upon the version of the operating system. By default, Windows NT 5.1 (Windows XP) and newer versions use "\WINDOWS", Windows NT 5.0 (Windows 2000), Windows NT 4.0 and Windows NT 3.1 use "\WINNT", Windows NT 3.5x uses "\WINNT35", and Windows NT 4.0 Terminal Server uses "\WTSRV".
This variable points to the Windows directory (on Windows NT-based operating systems it is identical to the %SystemRoot% variable, above). If the system is on drive C:, then the default values are "C:\WINDOWS" on Windows 95, Windows 98, Windows Me, Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008 and Windows 7 and "C:\WINNT" forWindows NT 4, and Windows 2000. Windows NT 4 Terminal Server Edition by default installs to "C:\WTSRV".

User management variables[citation needed] store information related to resources and settings owned by various user profiles within the system. As a general rule, these variables do not refer to critical system resources or locations that are necessary for the OS to run.

%ALLUSERSPROFILE% (%PROGRAMDATA% for Windows Vista, Windows 7)
This variable expands to the full path to the All Users profile directory. This profile contains resources and settings that are used by all system accounts. Shortcut links copied to the All Users\' Start menu or Desktop directories will appear in every user's Start menu or Desktop, respectively.
The name of the Workgroup or Windows Domain to which the current user belongs. The related variable, %LOGONSERVER%, holds the hostname of the server that authenticated the current user's logon credentials (name and password). For home PCs and PCs in a workgroup, the authenticating server is usually the PC itself. For PCs in a Windows domain, the authenticating server is a domain controller (a primary domain controller, or PDC, in Windows NT 4-based domains).
A special system-wide environment variable found on Windows NT and its derivatives. Its value is the location of the current user's profile directory, in which is found that user's HKCU registry hive (NTUSER). Users can also use the %USERNAME% variable to determine the active users login identification.

Optional System variables[citation needed] are not explicitly specified by default but can be used to modify the default behaviour of certain built-in console commands. These variables also do not need to be explicitly specified as command line arguments.

Default values

The following tables shows typical default values of certain environment variables under English versions of Windows as they can be retrieved under">CMD.

(Some of these variables are also defined when running COMMAND.COM under Windows, but differ in certain important details: Under COMMAND.COM, the names of environment variable are always uppercased. Some, but not all variables contain short 8.3 rather than long file names. While some variables present in the CMD environment are missing, there are also some variables specific to the COMMAND environment.)

Variable Locale specific Windows XP (CMD) Windows Vista/7/8 (CMD)
%ALLUSERSPROFILE%[7] Yes C:\Documents and Settings\All Users C:\ProgramData[7]
%APPDATA%[7] Yes C:\Documents and Settings\{username}\Application Data C:\Users\{username}\AppData\Roaming[7]
%CommonProgramFiles%[7] Yes C:\Program Files\Common Files C:\Program Files\Common Files[7]
%CommonProgramFiles(x86)%[7] Yes C:\Program Files (x86)\Common Files (only in 64-bit version) C:\Program Files (x86)\Common Files (only in 64-bit version)[7]
%CommonProgramW6432%[7] Yes ? C:\Program Files\Common Files (only in 64-bit version)[7]
%COMPUTERNAME% No {computername} {computername}
%ComSpec% No C:\Windows\System32\cmd.exe C:\Windows\System32\cmd.exe
%HOMEDRIVE%[7] No C: C:[7]
%HOMEPATH%[7] Yes \Documents and Settings\{username} \Users\{username}[7]
%LOCALAPPDATA%[7] Yes C:\Users\{username}\AppData\Local[7]
%LOGONSERVER% No \\{domain_logon_server} \\{domain_logon_server}
%PATH% Yes C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;{plus program paths} C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;{plus program paths}
%PATHEXT% No .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.WSF;.WSH .com;.exe;.bat;.cmd;.vbs;.vbe;.js;.jse;.wsf;.wsh;.msc
%ProgramData%[7] Yes %SystemDrive%\ProgramData[7]
%ProgramFiles%[7] Yes %SystemDrive%\Program Files %SystemDrive%\Program Files[7]
%ProgramFiles(x86)%[7] Yes %SystemDrive%\Program Files (x86) (only in 64-bit version) %SystemDrive%\Program Files (x86) (only in 64-bit version)[7]
%ProgramW6432%[7] Yes ? %SystemDrive%\Program Files (only in 64-bit version)[7]
%PROMPT% No Code for current command prompt format, usually $P$G Code for current command prompt format, usually $P$G
%PSModulePath% %SystemRoot%\system32\WindowsPowerShell\v1.0\Modules\
%PUBLIC%[7] Yes %SystemDrive%\Users\Public[7]
{Drive}:\$Recycle.Bin C:\Recycle.Bin C:\$Recycle.Bin
%SystemDrive%[7] No C: C:[7]
%SystemRoot%[7] No The Windows directory, usually C:\Windows, formerly C:\WINNT %SystemDrive%\Windows[7]
%TEMP%[7] and %TMP%[7] Yes %SystemDrive%\Documents and Settings\{username}\Local Settings\Temp %SystemDrive%\Users\{username}\AppData\Local\Temp[7]
%USERDOMAIN% No {userdomain} {userdomain}
%USERNAME% No {username} {username}
%USERPROFILE%[7] Yes %SystemDrive%\Documents and Settings\{username} %SystemDrive%\Users\{username}[7]
%windir%[7] No %SystemDrive%\WINDOWS %SystemDrive%\Windows[7]

In this list, there is no environment variable that refers to the location of the user's My Documents directory, so there is no standard method for setting a program's home directory to be theMy Documents directory.

Written by DataEase 30/05/15 at 13:26:29 Dataease [{8}]FIVE