The CONFIG.SYS system file is used by the MS-DOS operating system during
bootstrap. This text file loads device drivers for computer hardware that
is not supported by the ROM BIOS. To reflect any changes made to this file,
the computer must be restarted. The CONFIG.SYS file is stored in the root
directory of the active boot partition.
The commands in CONFIG.SYS establish settings for your hardware or load
control programs that enable your system to use the hardware installed
in the system.
CONFIG.SYS Example:
DEVICE=C:\DOS\HIMEM.SYS
DEVICE=C:\DOS\EMM386.EXE noems
BUFFERS=40
FILES=40
DOS=UMB
DOS=HIGH
DEVICE Loads a device driver - a routine that controls a hardware component such as memory.
DEVICE=C:\DOS\HIMEM.SYS - himem.sys is a memory manager for extended memory (directly accessible memory above the first 1M). HIMEM.SYS allocates and tracks extended memory use so that no two programs and/or device drivers can destroy each others data by using the same memory locations at the same time.
DEVICE=C:\DOS\EMM386.EXE noems - emm386.exe provides access to upper memory and can use extended memory to simulate expanded or paged memory. The noems option specifies that expanded memory is not required; in this form, emm386 is providing access to the upper memory area. If expanded memory is required, omit the noems parameter.
DEVICEHIGH - Loads a device driver into upper memory.
BUFFERS - Specifies how much memory DOS reserves for transferring data to and from disks. If you are running solely under DOS, you may need more buffers.
BUFFERS=N - You may have heard of disk caching. As you've noticed, diskette access is very slow, even a hard disk has access times much slower than RAM. Disk caching sets aside RAM to hold a copy of the most recently accessed disk information (files). For example, if a database application is continually accessing a disk, the first access is read from the disk but the next time it is read from the RAM cache. By default, N is set to 8 on most DOS systems. This means that RAM will set aside 8 buffers (512 bytes each) to hold the last 8 disk sectors accessed.
Note: If you are using SMARTDRV.EXE then set your BUFFERS=10. SMARTDRV is more efficient and can use extended memory. This will leave more conventional memory for your programs to run in.
FILES - Specifies the maximum number of files that can be open simultaneously.
DOS=UMB - Specifies that DOS should manage the upper memory blocks. This allows you to load device drivers and memory resident programs in upper memory (between 640KB and 1,024KB) leaving more conventional memory available for application programs. This command requires the EMM386.EXE driver to be loaded.
DOS=HIGH - Specifies that DOS should load a portion of itself into the high memory area (the first 64K of extended memory, or between 1,024KB and 1,088KB). This can make up to an additional 40K of conventional memory available for application programs. This command requries HIMEM.SYS to be loaded.
DOS=HIGH,UMB - A combination of the two examples above (syntax: DOS=HIGH|LOW[,UMB|,NOUMB]). This command will require both HIMEM.SYS and EMM386.EXE to be loaded.
INSTALL - Loads memory-resident program ie : INSTALL=C:\DOS\SHARE.EXE/F:500/L:500.
LASTDRIVE - Specifies number of drives computer can access ie : LASTDRIVE=Z.
NUMLOCK - Sets NUMLOCK key on or off.
SHELL - Specifies name and location of command interpreter (default is command.com).
FCBS - Specifies number of file control blocks DOS can have open at same time.
SWITCHES - Specifies special options in MS-DOS ie : /n will disable use of F5 and F8 to bypass commands.
STACKS=9,256 - Used to increase scratch pad memory (used for interrupt handling).
Increasing The DOS Environment:
DOS sets up a special section of memory called the environment which
has a default size of 160 bytes. This area must hold the path, the
prompt, the place that COMMAND.COM can be found and various other
strings. Programs can communicate with you by asking you to place
information in the environment with the SET command. In addition you
can keep global variables in the environment to pass between BATch
files. If you attempt to place more there than it has room for you'll
get a message "Out of environment space".
With DOS 3.1 and later there is a CONFIG.SYS command allowing you to
increase the amount of space reserved for your environment.
The syntax is:
SHELL=C:\COMMAND.COM /P /E:nnn
where n is the number of bytes you want to set aside for the environment.
For DOS 6.22 nnn represents the number of bytes you want to set aside.
For a 2K environment: [/E:2048].
CONFIG.SYS Menu:
During the bootstrap process, you can have CONFIG.SYS display a selectable
menu. This is useful for choosing which device drivers you want loaded.
The first line of the CONFIG.SYS file should begin with the block "[MENU]".
Use the following commands within the [MENU] block:
MENUITEM=blockname, [menutext]: The MENUITEM command can be used only within a menu block in your CONFIG.SYS file. menutext tells DOS the text to display for each option. Up to nine menu options can be displayed in each menu. blockname tells DOS the name of the configuration block that should be executed when the menu item is selected.
Options:
blockname - Specifies the name of the configuration block that DOS will execute when a menu item is selected. The name can be up to 70 characters long but cannot include the following characters: \ / , ; = [ ]
menutext - Specifies the text you want to display as the menu option. You can use up to 70 characters, including spaces. If you do not specify the menu text, the blockname will be displayed in the menu.
MENUDEFAULT=blockname, [timeout]: You can only use one MENUDEFAULT= line within a menu block in your CONFIG.SYS file. The default menu option that you specify with the MENUDEFAULT command will only be executed if you do not select another option within the specified timeout period. You can also stop the timeout count by pressing any key on the keyboard during the timeout period. Then you can select an alternative option by using the arrow keys to move the highlight from one option to the next, or by entering the line number of the option you want to execute.
Options:
blockname - Specifies the menu line that DOS will highlight when the menu is displayed.
timeout - Specifies the number of seconds (0 to 90) that DOS will wait before starting the system using the default menu option, if no other option is selected. If 0 is used, the specified option will immediately be executed.
MENUCOLOR=textcolor,[background]: The MENUCOLOR command can only be used inside a menu block within your CONFIG.SYS file. The colors specified will be used by DOS to display all text. If you do not use the MENUCOLOR command, DOS will display white text on a black background. If you want to set the background color, you must set the foreground color first. However, you can change the foreground color without changing the background. The colors that you select using the MENUCOLOR command stay in effect until another command, or a program, resets them. If you run CLS, the screen colors will be set back to the default of white text on a black background. If you find that the text on your screen is blinking, try setting the background color to a lower value (below 7).
Options:
textcolor - Specifies the color (0 to 15) to be used for foreground text.
background - Specifies the color (0 to 15) to be used for background colors.
0 - black 8 - gray
1 - blue 9 - bright blue
2 - green 10 - bright green
3 - cyan 11 - bright cyan
4 - red 12 - bright red
5 - magenta 13 - bright magenta
6 - brown 14 - yellow
7 - white 15 - bright white
CONFIG.SYS and AUTOEXEC.BAT Menu Example:
CONFIG.SYS:
[MENU]
menuitem=_DOS, MS-DOS
menuitem=_DCD, MS-DOS w/CD-ROM
menuitem=_WIN, MS-DOS -> Windows
menudefault=WIN,10
menucolor=7,0
[_ALL]
;Place commands not COMMON but common to some.
SHELL=C:\COMMAND.COM C:\ /e:1024 /p
[_DOS]
INCLUDE _ALL
[_DCD]
DEVICE=MTMCDAI.SYS /D:mscd001
INCLUDE _ALL
[_WIN]
DEVICE=C:\DOS\HIMEM.SYS
INCLUDE _ALL
[COMMON]
;Here we put any other "common" configurations ...
FILES=50
BUFFERS=30
AUTOEXEC.BAT:
:_BEG
@ECHO OFF
GOTO %config%
:_ALL
PROMPT $P$g
PATH C:\DOS;C:
APPEND D:\ /x
GOTO _END
:_DOS
ECHO You Chose DOS
GOTO _ALL
:_DCD
ECHO You chose DOS w/CD-ROM support.
GOTO _ALL
:_WIN
ECHO You chose Windows.
GOTO _END
:_END
The above demonstrates the use of goto blocks in the AUTOEXEC.BAT file. When
a user chooses an option from the CONFIG.SYS menu, the menu choice's
designations such as _DOS, _DCD, _WIN, etc will be held in an environment
varible "config" that designates which block was chosen in CONFIG.SYS. To
use this feature, simply use the command GOTO %config% and it
will jump to the block corresponding with the CONFIG.SYS selection.