Using environment variables with Cmd.exe
The Cmd.exe command-shell environment is defined by variables that determine the behavior of the command shell and the operating system. You can define the behavior of the command-shell environment or the entire operating system environment by using two types of environment variables, system and local. System environment variables define the behavior of the global operating system environment. Local environment variables define the behavior of the environment of the current instance of Cmd.exe.
System environment variables are preset in the operating system and available to all Windows server operating system processes. Only users with administrative credentials can change system variables. These variables are most commonly used in logon scripts.
Local environment variables are only available when the user for whom they were created is logged on to the computer. Local variables set in the HKEY_CURRENT_USERhive are valid only for the current user, but define the behavior of the global operating system environment.
The following list describes the various types of variables in descending order of precedence:
- Built-in system variables
- System variables found in the HKEY_LOCAL_MACHINE hive
- Local variables found in the HKEY_CURRENT_USER hive
- All environment variables and paths set in the Autoexec.bat file
- All environment variables and paths set in a logon script (if present)
- Variables used interactively in a script or batch file
In the command shell, each instance of Cmd.exe inherits the environment of its parent application. Therefore, you can change the variables in the new Cmd.exe environment without affecting the environment of the parent application.
The following table lists the system and local environment variables for the Windows server operating system.
Reference: http://technet.microsoft.com/en-us/library/cc737438%28WS.10%29.aspx