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 <a href="<a href=" http:="" en.wikipedia.org="" wiki="" environment_variable#.25os.25"="">%OS%</a>"><a href="http://en.wikipedia.org/wiki/Environment_variable#...">http://en.wikipedia.org/wiki/Environment_variable#...</a> 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<a href="<a href=" http:="" en.wikipedia.org="" wiki="" environment_variable#.24path"="">$PATH</a>"><a href="http://en.wikipedia.org/wiki/Environment_variable#...">http://en.wikipedia.org/wiki/Environment_variable#...</a> variable.
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".
User management variables 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 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.
The following tables shows typical default values of certain environment variables under English versions of Windows as they can be retrieved under
<a href="<a href=" http:="" en.wikipedia.org="" wiki="" cmd_(windows)"="">http://en.wikipedia.org/wiki/CMD_(Windows)</a>">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.)
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.