Table of Contents
The environment is an area of memory associated with the command processor that provides up to 32KB of space for storing variables, the variables contain information about the operating environment that is used by the operating system and other programs in various ways, typically to inform a program of the location of a certain piece of information it requires. A few examples follow:
ComSpec, specifies the location of the command interpreter.
PATH, specifies the locations to search for commands typed at the command line.
Prompt, specifies how the command prompt should appear to the user.
AGE, a user-defined variable for indicating the age of something.
TEMP, specifies the directories where temporary files should be placed.
Sometimes it is necessary to modify certain environment variables, for instance, we may have installed a new program in a directory such as C:\tools\chipper\, and its executable files may be stored in C:\tools\chipper\bin\. We may desire to execute this program from the command line but find that we get an error saying something like:
'chipper' is not recognized as an internal or external command, operable program or batch file.
|
Because we had not updated the PATH to point to the location of the binary files for this program.
In order to use the tools you are inherently going to have to install it is necessary to setup the operating environment so that the tools know where to find stuff they need and the operating system knows where to find the tools. You must understand how to do this as you will frequently be asked to change the operating environment.
Windows contains an environment variable called PATH, this is a list of directories which tell windows where to look for executable files, commands typed in at the command prompt. When you type in a command, windows will search the directories listed in PATH to see if it can find it. Since most of the tools we will be installing run from the command prompt we will have to extend the PATH environment variable so that windows knows about our tools and we can use them.
Altering environment variables will depend on what version of Windows you are using, in NT and Windows 2000 it is quite straightforward:
From the start menu goto settings then control panel
Double click on the System icon, this will bring up a dialog box.
Click on the advanced tag and then environment variables, this will bring up another dialog box with two scrollable windows, in Windows 2000 the top one is for local variables and the bottom for SYSTEM variables, in Windows NT it is the other way round.
Find the environment variable named PATH and click on it. It should be self-explanatory To edit a variable, click on edit, to add a new variable, click on new. The only SYSTEM variable we will edit is PATH all the other environment variables we will edit will be LOCAL. When I talk about appending to/adding to an environment variable I mean editing it and sticking another filename on the end.
Windows uses the convention that environment variables are separated by this character ";" If you are appending to a list of directories make sure you add this character onto the end of the list before you add your directory to the list. Do not add ";" after the last filename in the list as this may cause problems, just make sure that directory entries are separated by ";"'s.
In order to setup environment variables on Windows 95/98, you need to edit a file called autoexec.bat, this is located at C:\autoexec.bat, opening it with notepad is sufficient. If you do not like notepad then try clicking start/run and then typing sysedit this will bring up a built in editor for your system files, which crashed on my system. Or if you really desire so, you could type.
C:\>editautoexec.bat
|
Do what ever is necessary to edit the file, it should look something like this:
@echo off
SET SOUND=C:\PROGRA~1\CREATIVE\CTSND
SET BLASTER=A220 I5 D1 H5 P330 E620 T6
SET PATH=C:\WINDOWS;C:\
LH C:\WINDOWS\COMMAND\MSCDEX.EXE /D:123
LH C:\MOUSE\MOUSE.EXE
DOSKEY
CLS
|
autoexec.bat is executed on startup in order to setup your computer so that the drivers for your hardware are loaded etc. This is also where it sets up environment variables, you should be able to see that the line.
SET PATH=C:\WINDOWS;C:\ |
Is how autoexec.bat defines the PATH environment variable. To append to this list of directories simply add ";" and then add the new directory path to the end. In the example above, there are two paths specified and these are separated by a ";". You will have to reboot your system in order for these environment variables to be set. Separate filenames with ";"' but do not put a ";" on the absolute end of the list.
![]() | Note | |
|---|---|---|
To add an environment variable to autoexec.bat all we have to do is insert a new line defining the variable, for example, if we wanted to add an environment variable called SGML_CATALOG_FILES we would add the line:
| ||
If you are using WindowsME goto start/programs/accessories/systemtools/system information. This will bring up a window entitled Microsoft Help and Support. Goto the tools menu and select the system configuration utility, select the environment tab, select PATH and click on edit. To append to the list just type your directory onto the end of the list. Separate filenames with ";"' but do not put a ";" on the absolute end of the list.