Windows NT has three levels of environment variables, the system environment variables, the user environment variables, and the environment variables that are set in the AUTOEXEC.BAT file. There are also some predefined environment variables that are set when the user logs on.

System Environment Variables

System environment variables can be viewed in Control Panel / System / Environment. These variables apply to all users and cannot be changed by any user. There are some predefined variables, some of which do not appears in the System dialog box:

USERNAME
USERDOMAIN
USERPROFILE
WINDIR
OS
Os2LibPath
Path
PATHEXT
ComSpec
PROCESSOR_ARCHITECTURE
PROCESSOR_LEVEL
NUMBER_OF_PROCESORS
PROCESSOR_IDENTIFIER
PROCESSOR_REVISION
PROMPT
HOMEPATH
HOMEDRIVE
HOMESHARE
LOGONSERVER
COMPUTERNAME
SystemRoot
SystemDrive

If the home directory uses universal naming conventions:

HOMESHARE=\\<server name>\<share name>

If the home directory is a local path:

HOMESHARE=

All above environment variables are always present and therefore may be used in log on scripts (see tip 120 for W95 clients).

User Environment Variables

User environment variables can be viewed from Control Panel also. The user may add, delete or modify the user environment variables. These variables take precedence over system environment variables. The user path is appended to the system path.

AUTOEXEC.BAT Environment Variables

All environment variables and the paths set in the AUTOEXEC.BAT file are used to create the Windows NT environment. Any paths in the AUTOEXEC.BAT file are append to the system path.

Environment variables are set in the following order:

- System variables
- AUTOEXEC.BAT variables
- User variables

The Path is constructed by appending the User path to the System path and then appending the path from the AUTOEXEC.BAT file.

If you type SET from a CMD.EXE prompt, you will see the environment variables.

See tip 170 for a freeware batch environment editor.