Configuring environment variables in Windows NT

Environment variables are used almost everywhere in Windows, and there are several types of environment variables: (Listed in initialization order)

  1. System generated like %DATE%, %TIME%, %SYSTEMROOT%, %COMPUTERNAME%, created when Windows starts
  2. Local Machine specified (Same for all users ex. PATH)
  3. AUTOEXEX.BAT specified
  4. System generated like %USERNAME%, %USERDOMAIN% and %USERPROFILE% are created when user logs in
  5. User specified (Unique for this user)
  6. Command Prompt specified (Lives and dies with the command prompt)

Local Machine and User specified variables can be configured here:

  • WinNT4 : Control Panel -> System -> Environment-tab
  • Win2k/Xp : Control Panel -> System -> Advanced-tab -> Environment Variables-button

They can also be accessed through the registry (STRINGs) :

[HKEY_LOCAL_MACHINE \SYSTEM \CurrentControlSet \Control \Session Manager \Environment]

[HKEY_CURRENT_USER \Environment]

Note the environment variables will be available both in the Cmd.exe and the MS-DOS Environment