Environment Variables

This manual often refers to the host machine's environment variables. These are values maintained by the host operating system that can be changed by the user. Exactly how an environment variable is set differs among various operating systems:

  1. With Windows NT/2000/2003/XP, environment variables are set using the System applet in the Control Panel. Windows must be restarted for the new values to take effect.
  2. With Windows 98/ME, environment variables can be defined in the autoexec.bat file (with the same syntax that's used with MS-DOS). Any changes made to the autoexec.bat file require restarting Windows to take effect. Environment variables can be defined temporarily by booting to MS-DOS mode, defining variables with the SET command and then starting Windows. Variables defined in this way persist until the system is rebooted.
  3. On Windows systems where the console runtime (crun32) is used, environment variables are inherited from the Windows environment. Temporary environment variables can be defined in the console window (DOS-box) with the SET command. For example, to set the environment variable SORT_DIR to C:\TEMP\, you would use the following line:
    SET  SORT_DIR=C:\TEMP\

    Variables defined in this way persist until the DOS-box is closed. Forward slashes (/) may be used in place of backslashes (\). Upper-case and lower-case letters are interchangeable.

  4. On UNIX and Linux systems, the environment is controlled in one of two fashions, depending on which command shell you are using. If you are using the Bourne shell (sh) or the Korn shell (ksh), then you set a shell variable to the desired value and then export that variable. For example:
    SORT_DIR=/tmp/;  export SORT_DIR

    If you are using the C-shell instead, then you use the setenv command. For example:

    setenv  SORT_DIR  /tmp/

    Upper-case and lower-case environment variables are distinct. If you are using a different shell, see the documentation for that shell, or ask your system administrator.

  5. On VAX/VMS systems, you set a symbol to the desired value. For example:
    SORT_DIR == "$DISK1:[TEMP]"

    Unlike UNIX, upper-case and lower-case variable names are treated the same on VMS.