Environment Variables in Windows NT

Last reviewed: March 24, 1997
Article ID: Q100843
The information in this article applies to:
  • Microsoft Windows NT operating system version 3.1
  • Microsoft Windows NT Advanced Server version 3.1
  • Microsoft Windows NT Server version 4.0
  • Microsoft Windows NT Workstation version 4.0

There are three levels of environment variables in Windows NT; 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. This article discusses the following topics:

  • System environment variables
  • User environment variables
  • AUTOEXEC.BAT environment variables
  • How environment variables are set
  • How the path is built
  • Changing user environment variables using control panel

System Environment Variables

System environment variables can be viewed from Control Panel by choosing the System icon. These variables are always set no matter who logs on and they cannot be changed by any user.

There are a few additional predefined environment variables that are set when the user logs on that do not appear in the System dialog box:

   USERNAME
   USERDOMAIN
   NTVERSION (not available in Windows NT 4.0 anymore)
   WINDIR
   OS
   PROCESSOR_ARCHITECTURE
      values: x86, MIPS or ALPHA
   PROCESSOR_LEVEL
      values for x86: 3, 4, 5
      values for MIPS: 3000, 4000
      values for ALPHA: 21064
   HOMEPATH
   HOMEDRIVE
   HOMESHARE
      These three environment variables are set based on the value of
      the home directory. The user's home directory is specified in
      User Manager (Choose Profile and Properties). If the home
      directory uses universal naming conventions (UNC), then they
      will have the following values:

          HOMESHARE=\\<server name>\<share name>
          HOMEPATH=\<path>
          HOMEDRIVE=<drive letter>:

      If the home directory is a local path such as c:\nt then they
      will look like this:

          HOMEDRIVE=c:
          HOMESHARE=
          HOMEPATH=\nt

All above environment variables are always present and therefore may be used in log on scripts.

User Environment Variables

User environment variables can be viewed from Control Panel as well. The user may add, delete or modify the environment variables in the User Environment Variables for User field. 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.

How Environment Variables Are Set

Environment variables are set in the following order:

  • System variables
  • AUTOEXEC.BAT variables
  • User variables

How the Path Is Built

The Path is constructed from the system path, which can be viewed in the System Environment Variables field in the System dialog box. The User path is appended to the system path. Then the path from the AUTOEXEC.BAT file is appended.

Note: The environment variables LibPath and Os2LibPath are built the same way (system path + user path + AUTOEXEC.BAT path).

Changing User Environment Variables Using Control Panel

User environment variables can be added, changed or deleted from Control Panel. There is no need to reboot after making any of these changes. Changes take effect immediately after exiting the System dialog box.

The next application you start will use the new settings. All other applications running before the changes were made will not recognize the changes.


Additional query words: prodnt winnt
Keywords : kbenv ntconfig NTSrvWkst
Version : 3.1 4.0
Platform : WinNT


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: March 24, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.