If you are not a long-time computer user, or if you have always had someone else maintain your system configurations for you, you might not be familiar with the roles played by two important files during startup. The CONFIG.SYSand AUTOEXEC.BATfiles customize the way your computer is configured. These files load drivers, set options, and tweak the DOS envi-ronment.
The DOS environment is a space in memory reserved for creating variables that can be looked at by programs running on your system. The default size of the DOS environment is only 256 bytes in length. Some programs make extensive use of the DOS environment to store customization settings. You can use the SHELLcommand to increase the size of the environment.
➔ For a detailed description of the syntax and usage of the SHELLcommand, see Appendix F, “Command Reference,” p. 583.
System Configuration 27
CONFIG.SYS
During the boot process, as soon as IO.SYSand MSDOS.SYSare loaded into memory and before COMMAND.COMis loaded, a search is made of the root directory of the boot disk to see whether the CONFIG.SYSfile exists. On 99% of the computers in use today, the file is avail-able.
When CONFIG.SYSis found, its contents are read into memory, and the file is acted on line by line. Each line in CONFIG.SYScontains a DOS command that tells DOS to enhance the DOS configuration.
A number of DOS commands are valid in CONFIG.SYS. Table 2.1 gives a quick rundown of those commands. For detailed information, refer to Appendix F, “Command Reference.”
Table 2.1 Commands Often Used in CONFIG.SYS
Command Meaning
BREAK Determines how DOS reacts to the Ctrl+Break or Ctrl+C keystrokes.
BUFFERS Sets the number of file buffers DOS uses in transferring data to and from disk.
COUNTRY Configures language-dependent features.
DEVICE Loads a device driver (special software to control your computer’s configuration) in conventional memory.
DEVICEHIGH Loads a device driver into upper memory (above 640KB).
DOS Determines whether DOS is loaded into the high memory area and whether DOS maintains links to upper memory blocks.
DRIVPARM Modifies the parameters for an existing drive by specifying information about tracks, sectors, heads, and so on.
FCBS Determines the number of file control blocks that can be open simultaneously.
Needed only for ancient software compatibility.
FILE Sets the number of files that can be open simultaneously.
INCLUDE Includes the contents of a configuration block.
INSTALL Loads a memory-resident (TSR) program.
LASTDRIVE Specifies the highest valid disk drive letter.
MENUCOLOR Defines a startup menu’s text and background colors.
MENUDEFAULT Specifies the default configuration block and a timeout value.
MENUITEM Identifies items on the startup menu.
NUMLOCK Specifies the initial setting of the NUMLOCK key.
REM Creates a remark. Nothing following REMon the same line is acted on by DOS during booting.
SET Creates and sets values for environment variables.
SHELL Informs DOS what command processor should be used. SHELLalso is used to increase the default size of the DOS environment.
2 I
Part
Ch
28 Chapter 2 Starting DOS
STACKS Sets the number and size of stacks used to process hardware interrupts.
SUBMENU Provides the capability to add a second level of menus.
SWITCHES Specifies special DOS options.
Figure 2.1 shows the contents of a typical CONFIG.SYSfile. In all likelihood, the DOS instal-lation program either created or modified your CONFIG.SYSfile.
Table 2.1 Continued
Command Meaning
Figure 2.1 A typical CONFIG.SYS
file. DEVICE=C:\DOS\HIMEM.SYS
DEVICE=C:\DOS\EMM386.EXE NOEMS HIGHSCAN NOVCPI WIN=B500-B7FF
WIN=B200-ÂB4FF
DOS=UMB, HIGH BUFFERS=15, 0 FILES=49 LASTDRIVE=N STACKS=9, 256 SWITCHES=/k /f
SHELL=C:\DOS\COMMAND.COM C:\DOS\ /e:512 /P DEVICEHIGH /L:2,12048 =C:\DOS\SETVER.EXE
DEVICEHIGH /L:2,10928 =C:\DOS\SBPCD.SYS /D:MSCD001 /P:220 DEVICEHIGH /L:2,44784 =C:\DOS\DBLSPACE.SYS /MOVE
As you can see in this figure, a great deal is going on. Table 2.2 provides a quick play-by-play of each line of the CONFIG.SYSfile shown in Figure 2.1. If you want more in-depth information about one of the commands discussed here, see the “Command Reference.”
Table 2.2 Play-by-Play of a Typical CONFIG.SYSFile
Command Meaning
DEVICE=C:\DOS\HIMEM.SYS Uses the DEVICEcommand to load HIMEM.SYS, the Extended Memory Manager. HIMEM.SYSaccesses memory addresses above 1MB, including the high memory area from 1024KB to 1088KB. This file must be loaded before EMM386.
DEVICE=C:\DOS\EMM386.EXE Uses DEVICEto load EMM386.EXE, the NOEMS HISCAN NOVCPI WIN= Expanded Memory Manager. The parameters B500-B7FF WIN=B200-B4FF shown on this line (from left to right) specify no
EMS memory, check availability of upper memory blocks, disable VCPI support, and areas in upper reserve memory for Windows.
You must load EMM386.EXEto get access to upper memory (640KB to 1024KB).
System Configuration 29
DOS=UMB, HIGH Uses the DOScommand to specify that upper memory be used and to load portions of DOS into the high memory area (1024KB to 1088KB).
BUFFERS=15, 0 Sets up 15 buffers for transferring files, with 0 secondary cache buffers created.
FILES=49 Specifies that DOS make 49 file handles available so that many files can be open at a time.
LASTDRIVE=N Specifies that drive N is the highest drive present in the system. This setting should include drives created by DoubleSpace and any drives used by your network if you are connected to one.
STACKS=9, 256 Specifies that nine stacks of 256 bytes each are used to handle hardware interrupts.
SWITCHES=/k /f The /kswitch disables extended keyboard support, and the /fswitch dispenses with the default two-second delay after the Starting MS-DOS...
message appears during bootup.
SHELL=C:\DOS\COMMAND.COM Increases the size of the DOS environment to C:\DOS\ /e:512 /F 512 bytes. Don’t forget to use the /Pswitch if you
use this command; otherwise, DOS ignores AUTOEXEC.BATat boot time.
DEVICEHIGH /L:2,12048 = Loads the SETVER driver into upper memory.
C:\DOS\SETVER.EXE
DEVICEHIGH /L:2,10928 = Loads a CD-ROM driver into upper memory C:\DOS\SBPCD.SYS /D:MSCD01 /P:220 and specifies MSCD01 as the device name.
DEVICEHIGH /L:2,44784 = Loads the DoubleSpace driver into upper C:\DOS\DBLSPACE.SYS /MOVE memory.
If upper memory is not available when you use the DEVICEHIGHcommand, DOS loads drivers into conventional memory as though the DEVICEcommand were used.
You easily can customize your CONFIG.SYSfile by using the EDITcommand. Exercise caution, however, because you accidentally can alter commands that screw up your configuration.
Using the following command to make a backup of the file before editing is always a good idea:
COPY CONFIG.SYS CONFIG.OLD
That way, you can restore the old settings if something goes wrong.
When modifying any file, it is a good idea to not remove any lines, but rather add REM to the beginning of the line. This causes the file to ignore that line, because it is seen as a remark, not a command.
2 I
Part
Ch
Table 2.2 Continued
Command Meaning
30 Chapter 2 Starting DOS
AUTOEXEC.BAT
After COMMAND.COMis loaded into memory during the boot process, the system is ready for you to use. The last task the boot process performs is to look in the boot directory for the
AUTOEXEC.BATfile. If an AUTOEXEC.BATfile is found, it is then fed to COMMAND.COM’s batch-file processor.
AUTOEXEC.BATcan contain almost any legal DOS command, except those commands such as
DEVICEand SHELL, which are reserved for use in CONFIG.SYS. AUTOEXEC.BATis used mostly to run commands that further configure the DOS session and to run those commands that need to be run only once when the computer is started up.
Although DOS now enables you to use the SETcommand in either CONFIG.SYSor
AUTOEXEC.BAT, traditionally you found these SETcommands exclusively in AUTOEXEC.BATor in batch files run later for special purposes. There is one good reason to continue this practice.
If you have your initial SETcommands split between CONFIG.SYSand AUTOEXEC.BAT, you pos-sibly can create the same variable twice by using different values. If CONFIG.SYScontains the line SET TEMP=C:\TEMPand AUTOEXEC.BATcontains the line SET TEMP=C:\MYTEMP, for example, the value of the TEMPvariable is MYTEMPafter AUTOEXEC.BATis run.
In effect, AUTOEXEC.BATis nothing but a regular batch file. Two things make it special, how-ever. The first (and most important item) is that it is executed automatically each time your computer is booted. The second is that because AUTOEXEC.BATis considered part of the booting process, DOS 6.2 enables you to step interactively through each command in
AUTOEXEC.BAT, just as you can through CONFIG.SYS. This capability is discussed in more detail in the next section.
➔ For a better understanding of batch files, see Chapter 16, “Understanding Batch Files,” p. 389.
To better understand your AUTOEXEC.BATfile, check out Figure 2.2. It lists the contents of a typical AUTOEXEC.BATfile.
@ECHO OFF CLS
PROMPT $P$G
PATH C:\DOS;D:\WINDOWS;C:\;C:\NU SET PCPLUS-F:\PROCOMM
SET TEMP=C:\TEMP
SET BLASTER=A220 I5 D1 T2 SET SOUND=G:\SBPRO
LH /L:0;1,42432 /S C:\DOS\SMARTDRV.EXE LH /L:1,56928 C:\DOS\MOUSE.COM /Y LH /L:1,13984 C:\DOS\SHARE /L:500 LH /L:1,6400 C:\DOS\DOSKEY.COM
LH /L:1,46576 C:\DOS\MSCDEX /d:MSCD001 /M:15 /V SET WINPMT=Running Windows $P$G
WIN Figure 2.2
A sample AUTOEXEC.BATfile.
System Configuration 31
Table 2.3 provides a quick play-by-play of each line of the AUTOEXEC.BATfile shown in Figure 2.2.
Table 2.3 Play-by-Play of a Typical AUTOEXEC.BATFile
Command Meaning
@ECHO OFF Suppresses the display of the commands as they are processed. (The @symbol at the beginning of the line suppresses display of the command line.)
CLS Clears the screen.
PROMPT $P$G Alters the way the DOS prompt is displayed.
The $P$Gportion of the line causes the prompt to show the currently logged drive and path, fol-lowed by a greater-than sign (>). You can use the PROMPTcommand to turn the DOS prompt into anything you want it to be.
To learn how to change the look of the com-mand prompt, see “Changing the Comcom-mand Prompt with PROMPT” in Chapter 11, p. 295, and “Issuing ANSI.SYSCodes with the PROMPT Command” in Chapter 17, p. 419. Also, see
“PROMPT” in the “Command Reference.”
PATH C:\DOS;D:\WINDOWS;C:\;C:\NU Specifies where and in what order DOS should search directories when a command is entered at the DOS prompt or in a batch file. DOS looks in these directories for a COM, EXE, or BATfile having the same name as the command. Only after these directories have been searched does DOS return the dreaded Bad Command or File Nameerror message.
For detailed information about error and other messages, see Appendix C, “DOS Messages.”
SET PCPLUS=F:\PROCOMM These four lines use the SETcommand to place SET TEMP=C:\TEMP variables in the DOS environment.
SET BLASTER=A220 I5 D1 T2 Environment variables can contain character SET SOUND=G:\SOUNDPRO strings, which programs can use to determine
parameters. The SET BLASTERvariable, for example, documents the Sound Blaster Pro card’s installation parameters. Programs that play sounds routinely rely on this variable to provide information they need.
LH /L:0;1,42432 /S C:\DOS\SMARTDRV.EXE Loads the SMARTDRV.EXEutility into upper memory.
LH /L:1,56928 C:\DOS\MOUSE.COM /Y Loads the DOS mouse driver into upper memory.
LH /L:1,13984 C:\DOS\SHARE /L:500 Loads the SHARE.EXEutility into upper memory.
2 I
Part
Ch
32 Chapter 2 Starting DOS
LH /L:1,6400 C:\DOS\DOSKEY.COM Loads the DOSKEYutility into upper memory.
LH /L:1,46576 C:\DOS\MSCDEX Loads the MSCDEXutility, which assigns a drive /d:MSCD001 /M:15 /V letter to a CD-ROM drive that has been loaded
in CONFIG.SYS. The /dswitch specifies the drive name that was provided in CONFIG.SYS. SET WINPMT=Running Windows $P$G Creates an environment variable that specifies
how the DOS prompt should be displayed when you’re running a DOS session under Windows.
WIN Automatically launches Windows every time the
computer boots.
Remember, nothing is sacred or untouchable about AUTOEXEC.BAT; it’s simply another batch file. Use the EDITcommand to add and delete entries to create the exact startup configura-tion you want to have each time you use your computer. Creating a backup of the file before you edit it is always a good idea, of course. Use the following:
COPY AUTOEXEC.BAT AUTOEXEC.OLD
By creating a backup, you can restore the previous version if you accidentally mess up your configuration.
➔ For more information about the EDITcommand, see Chapter 15, “Using the DOS Editor,” p. 361.
➔ For more detailed information, see “Fine-Tuning Your Computer with CONFIG.SYSandAUTOEXEC.BAT” in Chapter 19, “Configuring Your Computer,” p. 463.