Windows 环境变量
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
Windows System Environment Variables
These system environment variables are automatically created by Windows upon boot-up in Windows Registry key HKEY_LOCAL_MACHINE\ SYSTEM\ CurrentControlSet\ Control\ Session Manager\ Environment
Variable Sample Typical Value
%SystemDrive% C:
%SystemRoot% C:\WINDOWS
C:\WINNT
%WinDir% C:\WINDOWS
C:\WINNT
%SystemDirectory% C:\WINDOWS\System32
C:\WINNT\System32
%ComSpec% C:\WINDOWS\system32\cmd.exe
The path including the command interpreter program.
%programfiles% C:\WINDOWS\Program Files
%Temp% C:\Users\W\AppData\Local\Temp on Windows Vista & 2008
C:\DOCUME~1\Usr\LOCALS~1\Temp (compressed form of)
C:\Documents and Settings\Usr\Local Settings\Temp
%Tmp%
%HOMEDRIVE% C: The drive letter associated with the user's home directory
%HOMEPATH% The path to the user's home directory as defined in UMD/AD (excluding drive):
\Users\
\Documents and Settings\Guest on Windows XP
%OS% Windows_NT (even on Windows Vista & XP machines
The operating system the user is running
%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% C:\Users\
%USERPROFILE%\Desktop The user's desktop folder
If you have the permissions, invoke, then open my DOS batch file 1envvars.bat which lists the values of these variables on your computer
Windows resolves commands typed in the start/run box first from files in %SYSTEMDRIVE%, then files in %SYSTEMROOT%. This is regardless of the systemdrive (such as E:) being later in the path. This means that a rogue file can be invoked instead of a good file (such as cmd.exe) if it's in the %SYSTEMDRIVE%.
Below are dynamic environment variables:
Variable Sample Typical Value
%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.
You can quickly reach the folder specified within an environment variable by typing that variable on the Address bar of Windows Explorer:
User Environment Variables Added by Applications
User environment variables are stored in Windows Registry HKEY_CURRENT_USER\Environment
Within a command batch file, to list Oracle Environment Variables
echo ORACLE_SID = %ORACLE_SID%
echo ORACLE_HOME = %ORACLE_HOME%
echo ORA_NLS = %ORA_NLS%
echo.
echo PATH = %PATH%
echo.
echo Machine Name to messenger service:
net name
Novell adds these environment variables during installation.
Variable
%USER%
%NWUSERNAME%
%NWLANGUAGE%
Creating Variables on Windows
Environment Variables can be created and changed using several mechanisms:
By Windows automatically upon boot-up.