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:
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.