CONFIGuring your SYStem by Ken Johnson, Chicago Computer Society One of the most important files on your hard disk is CONFIG.SYS. A few years ago, you probably would have never given much thought to this file -- in fact, many computers didn't even have one. Today however, it is becoming increasingly important that you understand what CONFIG.SYS is and what it does. This is particularly true if you are using Windows 3.0 and/or DOS 5.0, both of which use CONFIG.SYS to fine tune their operation. CONFIG.SYS is an ASCII text file containing specialized commands for SYStem CONFIGuration, therefore the name. You can use CONFIG.SYS to (depending on the version of DOS) configure memory, install TSRs, load device drivers, and change how DOS handles input/output operations. DOS looks for CONFIG.SYS in the root directory when it first boots up, and sets the computer's configuration according to the statements it finds in the file. It is important to note that CONFIG.SYS commands are acted upon before DOS executes AUTOEXEC.BAT. Configuring your system usually means making changes in both CONFIG.SYS and AUTOEXEC.BAT, with CONFIG.SYS commands having "priority". Being a text file, CONFIG.SYS can be easily modified with any editor capable of saving files as straight ASCII text. If you are using DOS 5.0, you can use DOS's EDIT program; a popular shareware editor is QEDIT. Remember that CONFIG.SYS commands are executed only when DOS is loading, which means that any changes you make to CONFIG.SYS take effect only after you reboot. Speaking of editing, many software programs will modify your CONFIG.SYS file as part of their installation process (and probably your AUTOEXEC.BAT file as well). The "better" installation programs will ask you whether you want the files changed, and make a backup copy of your old files. But some programs will make the changes without any warning. Before installing new software it is a good idea to make copies of your AUTOEXEC.BAT and CONFIG.SYS files under different names. That way you can look at the old and new versions and easily figure out what changes were made. Let's look at the commands used in the CONFIG.SYS file. The BREAK Command -- set Ctrl-Break testing Syntax: BREAK=ON or BREAK=OFF BREAK determines whether DOS will check for Ctrl-Break (or Ctrl- C) key press to interrupt a program's execution. The default is OFF, meaning DOS will check Ctrl-Break only when working with the video display, keyboard, parallel or serial ports. When BREAK is ON, DOS checks Ctrl-Break whenever the program requests any DOS services. You also can specify BREAK ON or BREAK OFF at the DOS prompt or in your AUTOEXEC.BAT file. The BUFFERS Command -- set the number of disk I/O buffers Syntax: BUFFERS=nn (DOS 3.x) BUFFERS=nn [,m] [/X] (DOS 4.01 & 5.0) where "nn" is the number of buffers to use; "m" is the number of preread buffers to allocate; and "/X" specifies to use expanded memory for buffers. BUFFERS is one of the most important of the CONFIG.SYS commands. Buffers are reserved areas of RAM that hold the most recently read disk sectors. Each buffer is slightly larger than one disk sector. When a program asks for data, DOS will read an entire disk sector at a time. When the program asks for the next piece of data, DOS will check the buffers to see if that data is present; if so, then DOS doesn't need to go back to the disk. Thus by increasing the number of buffers, you decrease the number of disk accesses and increase the speed of the application. The preread buffers ("m") in DOS 4.01 & 5.0 are used to read upcoming sectors before they are requested. The default is zero in DOS 4.01 and one in DOS 5.0. It is often recommended to set preread buffers at 8, since this allows DOS to read an entire floppy disk track at a time. The default number of buffers is 2 to 15, depending on the type of disk drives, amount of memory, and version of DOS. Typically you'll set buffers to between 20 and 40. There is a memory versus speed tradeoff, since each buffer takes about 1/2 K of RAM (though with DOS 5.0 buffers can be loaded into memory above 640K). Also, you do not want to set buffers too high, since this will actually slow down your system; DOS spends more time searching the buffers than the disk access would take. The "magic number" seems between 40 and 60 buffers. You also may be able to lower the number of buffers if you are using a disk cache, such as SmartDrive (SMARTDRV.SYS). Since disk caches perform the same function as buffers, by lowering the number of buffers you usually can free up some RAM without sacrificing performance -- unless accessing floppy drives. SmartDrive only caches the hard drive, whereas BUFFERS= improves speed with both hard drives and floppy drives. The COUNTRY Command -- set date and time formats Syntax: COUNTRY=xxx COUNTRY=xxx[,yyy] (DOS 3.3, 4.01, & 5.0) where "xxx" is the country code and "yyy" an optional code page. The code page is a translation table used to specify alternative character sets for display and printing. The COUNTRY command is used to set the date and time input and display formats. It also can make the appropriate currency symbol and decimal separator available for programs that request it. The default when no COUNTRY= command is specified is the United States (country code 001). The DEVICE Command -- install device drivers Syntax: DEVICE=[d:][path] filename.ext [switches] where "filename" is the name of the device driver program file, and "switches" are any options needed by the driver. The DEVICE command is used to install hardware device drivers. Devices include disk drives, the keyboard, the video display, and printer. The driver is software that links itself to DOS so that the computer can use the device. Common device drivers include: ANSI.SYS -- provides a means to use color in DOS displays and redefine keystrokes in DOS. Some programs also require ANSI.SYS be installed. HIMEM.SYS -- is the DOS standard Extended Memory Manger, for use on 286-, 386-, and 486-based computers. It makes the High Memory Area (the 64K above 1 meg) available for use by DOS, and gives necessary support for Windows 3.0 to run in standard or enhanced mode. HIMEM.SYS is provided with DOS 5.0. EMM386.EXE -- is a device driver and utility program that provides support for installing TSRs and device drivers in memory above 640K in 386- and 486-based computers. It also can emulate expanded memory for programs requiring that kind of memory. EMM386.EXE is provided with DOS 5.0. If using DEVICE=EMM386.EXE in your CONFIG.SYS file, you must use it after DEVICE=HIMEM.SYS and before any DEVICEHIGH= commands. SMARTDRV.SYS -- provides disk caching for computers with hard drives and expanded or extended memory. Cashing gives same benefit as buffers; recently read information from the disk is held in memory. When the information is needed by a program, obtaining it from the cache is much faster than a disk access. With SMARTDRV.SYS, you can specify the size of the cache (both maximum and minimum) and whether to place it in expanded or extended (the default) memory. The DEVICEHIGH Command (DOS 5.0) -- load device drivers into memory above 640K Syntax: DEVICEHIGH=[d:][path] filename.ext [switches] where "filename" is the name of the device driver program file, and "switches" are any options needed by the driver. DEVICEHIGH is a new CONFIG.SYS command with DOS 5.0. It is used to load device drivers into memory above 640K, thus freeing up more conventional memory for your programs. DEVICEHIGH works just like the DEVICE command, except DOS attempts to load the driver into reserved memory (between 640K and 1 meg). If there isn't room to load the driver above 640K, it will be loaded into conventional memory. You can use DOS' MEM command (with the /C switch) to see if the driver is in reserved or conventional memory. DEVICEHIGH can only be used on 386- and 486-based computers, and you must install both HIMEM.SYS and EMM386.EXE before any DEVICEHIGH= commands. The DOS Command (DOS 5.0) -- load DOS into High Memory Area Syntax: DOS=[HIGH or LOW] [,UMB or NOUMB] Also new with DOS 5.0, the DOS= command provides a way to load most of DOS itself into the High Memory Area, thus freeing up more of conventional memory for programs to use. It also provides access to reserved memory for the loading of TSRs and device drivers. "HIGH" and "LOW" refers to whether to load DOS into the 64K High Memory Area (above 1 meg). To load DOS high, you must have a 286-, 386-, or 486-based computer, and have already installed HIMEM.SYS. "UMB" and "NOUMB" determines whether to allow device drivers and TSRs to be loaded into Reserved Memory (called the Upper Memory Blocks). You load device drivers and TSRs into the UMB by way of the DEVICEHIGH= command in CONFIG.SYS and the LOADHIGH command in AUTOEXEC.BAT. To use the UMB, you must have a 386- or 486-based computer, and have previously installed HIMEM.SYS and EMM386.EXE. The FCBS Command -- set number of File Control Blocks Syntax: FCBS=nn,mm where "nn" is the maximum number of concurrently opened files (1 to 255) and "mm" is the number of FCBS DOS is not allowed to reuse automatically. File Control Blocks (FCBS) are rarely used today. Version 1 of DOS used FCBS to control open files, but since version 2.0 has used file handles (see below). The FCBS command allows older programs that don't use file handles to run under the more recent versions of DOS. The FILES Command -- set the number of file handles available Syntax: FILES=nn where "nn" is the number of files that may be open simultaneously. If not specified, the default is 8. The DOS before version 3.3, the maximum number of files that can be specified is 100; in 3.3 and above it is 255. The FILES command is probably the most important (with BUFFERS=) of the CONFIG.SYS statements. It determines the number of files that can be opened at once. DOS provides "file handles" that programs use to manipulate files and devices. If you get a message saying that there are not enough file handles available, you need to increase the number on the FILES= statement in CONFIG.SYS. Most programs today require at least FILES=20; databases often require FILES=30 or 40. Most programs will adjust the FILES= statement during their install if it is set too low. The INSTALL Command (DOS 4.01 & 5.0) -- load TSR programs Syntax: INSTALL=[d:][path] filename.ext [switches] where "filename" is the name of the TSR program to install, and "switches" are any options needed by that program. INSTALL provides a way in load TSR programs in CONFIG.SYS, rather than in your AUTOEXEC.BAT file. Technically, you may save a little RAM by installing TSRs through CONFIG.SYS than in AUTOEXEC.BAT. Also, since CONFIG.SYS is executed only when the computer boots up (unlike AUTOEXEC.BAT, which can be reexecuted from the DOS command line at any time), it is good place for loading DOS utility programs such as FASTOPEN.EXE and SHARE.EXE. But, if you are using DOS 5.0 and have a 386- or 486-based computer, you may be better off loading TSRs in AUTOEXEC.BAT rather than CONFIG.SYS. DOS 5.0 includes the LOADHIGH command (executable in AUTOEXEC.BAT or on the DOS command line), which can load TSR programs into the Upper Memory Blocks. There is no CONFIG.SYS equivalent for loading non-device drivers into memory above 640K. The LASTDRIVE Command -- set disk drive ID limit Syntax: LASTDRIVE=x where "x" is a single letter from A to Z. LASTDRIVE tells DOS the number of disk drives on your system. If not specified, the default is LASTDRIVE=E, meaning five total drives (which includes floppy drives, hard drives, and RAM disk). Each letter above "E" uses about 80 bytes of memory, so specifying LASTDRIVE=Z costs you about 2K. You probably don't need to worry about LASTDRIVE unless you use DOS' SUBST command. SUBST allows you to use a drive ID as a substitute for a directory path. LASTDRIVE determines the drive IDs you can use as substitutions. The REM Statement (DOS 4.01 & 5.0) -- "comment out" a line The REMark statement in CONFIG.SYS works the same way it does in a batch file. Anything on a line beginning with REM is ignored. If you want temporarily to disable a line in CONFIG.SYS without having to delete it, simply put a REM at the beginning. By the way, though the REM statement is not supported for CONFIG.SYS in versions of DOS before 4.0, you can still use it. DOS will ignore the line and display a message saying "Unrecognizable Command in CONFIG.SYS." The SHELL Command -- identify command interpreter; set DOS environment size Syntax: SHELL=[d:][path] filename [switches] where "filename" is the name of the command interpreter to use, and "switches" are program or environment options desired. The SHELL command tells DOS what command interpreter to use, and where that program is located. If you want to replace COMMAND.COM with another interpreter, this is how you tell DOS. You also can use the SHELL command to change the defaults for COMMAND.COM. For example, you can use the /E switch to increase the size of the DOS environment. Do not confuse the SHELL command with the DOS Shell program (DOSSHELL.COM) available in DOS 4.01 and 5.0. They are not related. The STACKS Command -- set number and size of stacks for interrupt handling Syntax: STACKS=nn,ss where "nn" is the number of stacks to allocate and "ss" is the size of each stack in bytes. The default number of stacks is 9, each with a size of 128 bytes (DOS 3.2 and above). A stack is a temporary holding area in RAM that DOS uses when a hardware interrupt occurs; the information that was being acted upon is stored in a stack while the interrupt is handled. Because interrupts can be nested (interrupts can occur while interrupts are being acted upon), DOS could run out of stack space. If this happens, you will be an "Internal Stack Failure, System Halted" message and have to reboot the computer. As you can tell, CONFIG.SYS is very important in configuring your system, and perhaps a little intimidating. As you add additional programs, DOS 5.0, or a memory manager such as QEMM, you'll likely spend time changing CONFIG.SYS to "fine tune" your system. Luckily, being a text file, it is easy to change with a text editor such as EDIT or QEDIT. Experienced (a.k.a. frustrated!) "tuners" have a couple of tricks when it comes to CONFIG.SYS. Perhaps the most important is to have backup copies of CONFIG.SYS and AUTOEXEC.BAT, either in a subdirectory or on the root directory under a different name (I call mine CONFIG.KEJ and AUTOEXEC.KEJ). That way you can make changes to the files, but always be can get back the original versions. These backups also let you see what changes were made by installation programs. Another trick is always to have a boot disk available before you start changing CONFIG.SYS. A boot disk is a floppy disk that allows you to boot from in the A: drive. It is possible to modify CONFIG.SYS incorrectly so that your computer locks up when it starts. A boot disk will allow you to start from a floppy, then change CONFIG.SYS. To make a boot disk, format a disk in the A: drive using the /S switch, which will format the floppy and copy the DOS system files to it. Then copy COMMAND.COM, AUTOEXEC.BAT, and CONFIG.SYS from your hard drive to the floppy. You may need to add the path to some program names in your DEVICE=, DEVICEHIGH=, INSTALL=, or SHELL= statements so that DOS can find the files on the hard drive (remember, A: will be the default drive). Finally, test out the boot disk to make sure it works. You also might want to have an extra copy or two of CONFIG files with different configurations for special purposes. For example, when using a disk compression program you shouldn't have a disk cache active. If you have loaded SMARTDRV.SYS in your CONFIG.SYS, you'll need to reboot without it. If you don't want to have to edit CONFIG.SYS to REMark out the DEVICE=SMARTDRV.SYS every time, create another configuration file without the statement. Now when you want to run the disk compress, copy this file to CONFIG.SYS and reboot the computer. After running the compress, copy your backup CONFIG file (the copy of the original) back to CONFIG.SYS and reboot. You can automate the procedure with two batch files. I call mine SMALLMEM.BAT and BIGMEM.BAT. SMALLMEM will copy over the "minimal" CONFIG and AUTOEXEC files I have saved (each with a ".000" extension) to CONFIG.SYS and AUTOEXEC.BAT. The batch file will then automatically reboot the computer, using a utility program from PC Magazine called REBOOTB.COM. These minimal files contain just the basics -- no extra device drivers, no cache, no DOS loaded high, no TSRs. Here's the SMALLMEM batch file: @ECHO OFF COPY C:\AUTOEXEC.000 C:\AUTOEXEC.BAT COPY C:\CONFIG.000 C:\CONFIG.SYS REBOOTB BIGMEM.BAT goes the other way. It copies over my backup CONFIG and AUTOEXEC files (each saved with a ".KEJ" extension) to CONFIG.SYS and AUTOEXEC.BAT. Notice the batch file doesn't automatically reboot; that's because I usually just shut off the computer since I've finished working for the time being. If I want to reboot, I just press CTRL-ALT-DEL. Here's the BIGMEM batch file: @ECHO OFF COPY C:\AUTOEXEC.KEJ C:\AUTOEXEC.BAT COPY C:\CONFIG.KEJ C:\CONFIG.SYS I hope this column has taken some mystery out of CONFIG.SYS. Perhaps unfortunately, the days of getting by with only FILES=10 and BUFFERS=10 are long gone. As programs, hardware, and DOS itself get more complex, knowing how to configure and fine tune your system though CONFIG.SYS is becoming more and more important. =================================================== Author Information: Ken Johnson is Training and Support Manager at the law firm of Mayer, Brown & Platt in Chicago. He is a contributing editor to Hard-Copy, the Journal of the Chicago Computer Society, and a contributing writer to the Lawyers MicroComputer Users Group newsletter.