ENVIRONMENT VARIABLES In MS-DOS, there are such variables called environment variables. These variables can be used in almost any program, and they share the same storage space, so usually environment variables can be used to store common information that will be shared by most programs. There is something special that batch programs can use environment variables, so these variables are also applied to batch programs for necessary information exchange when needed. For example, you can access the "PATH" environment variable using the format "%PATH%" in a batch program. Also, you can do it using "ENVIRON" function in BASIC, or using "getenv" function in C. Note: In Windows 9x/NT/2000, Windows has a common environment space. Besides, each program has its own environment space. The programs can share and change common environment variables, but cannot change those in running programs. For one program, the private environment space is independent to other programs. A program can make changes to its own environment space, and all code of the program can share it, but changes made in one program (such as a Command Prompt) don't affect other programs. Changes made to the common environment space can take effect in programs started after that action, but not in running programs. This is because a program usually has its own new copy of the common environment space when it is started. In Windows 9x, common environment variables are defined in the AUTOEXEC.BAT file. In Windows NT/2000, common environment variables are defined at "System Properties -> Advanced -> Environment Variables". They are composed of two parts: The System Variable Setting and the User Defined Variables. The latter will often override the previous. The System Variable Setting applies to any new user in Windows NT/2000. Still, there is a bug found when I was using MS-DOS command prompt in Windows NT/2000: In a batch file, it was all right. But in an old MS-DOS program (QBasic), the User Defined Variables don't lay over the System Variable Setting. This was discovered when I was using QBASIC to access the temporary folder. The temporary folder under an NT system should be inside the user profile, but the result of checking Environ$("TEMP") (note that TEMP is in upper case) in qbasic was C:\WINNT\TEMP. Below is a list of commonly seen environment variables: 1. COMSPEC This variable specifies the location of the command intepreter (the file name is COMMAND.COM in MS-DOS or in Window 9x, CMD.EXE in Windows NT). 2. PROMPT Specifies the prompt (usually $P$G - path name plus the "greater than" character). 3. TEMP Specifies the temporary directory for programs to store temporary files. To keep compatibility, it should better be specified in short file names. 4. PATH Specifies paths that MS-DOS or Windows should search for executable files. 5. windir Stores the Windows installation path (not available under MS-DOS). For more information, please refer to MS-DOS Help or Windows NT command line command help.