|
|
|
Environment Variables in Windows XP
Environment variables are strings that contain information
such as drive, path, or file name. They control the behavior
of various programs. For example, the TEMP environment variable
specifies the location in which programs place temporary files.
Table I. Some more common predefined environment
variables
| Variable |
Typical value (May vary, depending on system) |
| %ALLUSERSPROFILE% |
C:\Documents and Settings\All Users |
| %APPDATA% |
C:\Documents and Settings\{username}\Application
Data |
| %COMPUTERNAME% |
{computername} |
| %COMSPEC% |
C:\Windows\System32\cmd.exe |
| %HOMEDRIVE% |
C: |
| %HOMEPATH% |
\Documents and Settings\{username} |
| %PATH% |
C:\Windows\System32\;C:\Windows\;C:\Windows\System32\Wbem |
| %PATHEXT% |
.COM; .EXE; .BAT; .CMD; .VBS; .VBE; .JS ; .WSF; .WSH
|
| %PROGRAMFILES% |
Directory containing program files, usually C:\Program
Files |
| %PROMPT% |
Code for current command prompt format. Code is usually
$P$G |
| %SYSTEMDRIVE% |
The drive containing the Windows XP root directory,
usually C: |
| %SYSTEMROOT% |
The Windows XP root directory, usually C:\Windows
|
| %TEMP% and %TMP% |
C:\DOCUME~1\{username}\LOCALS~1\Temp |
| %USERNAME% |
{username} |
| %USERPROFILE% |
C:\Documents and Settings\{username} |
| %WINDIR% |
C:\Windows |
The so-called predefined variables are generally unchanged
during a login session but there are also some dynamic variables
whose value may change. Some of these are listed in the
next table.
Table II. Some dynamic environment variables
| Variable |
Value |
| %DATE% |
Current date in the format determined by the Date
command |
| %TIME% |
Current time in the format determined by the Time
command |
| %CD% |
Current directory with its full path |
| %ERRORLEVEL% |
Number defining exit status of a previous command
or program |
| %RANDOM% |
Random number between 0 and 32767 |
|
|
|
|
|