Autoexec.bat and config.sys help

Updated: 10/03/2024 by Computer Hope
Autoexec.bat file icon.

The autoexec.bat and the config.sys were files created for MS-DOS and Windows 3.x to load device and operating system files to properly run. These files are required for later revisions of MS-DOS and Windows 3.x to load. However, with newer versions of Windows are no longer needed.

How to edit the files

The auotexec.bat and the config.sys are edited by the MS-DOS command file edit. To edit these files, type edit c:\autoexec.bat to edit the autoexec.bat file, or edit c:\config.sys to edit the config.sys file. If the mouse drivers are not loaded properly, the mouse will not work.

If you have Windows 95, Windows 98, or Windows Me, we recommend you use the sysedit command. To run sysedit, click Start, Run, and type sysedit.

Note

Windows XP and later no longer use the autoexec.bat or config.sys file.

Remarking information

Remarking lines in the autoexec.bat or the config.sys lets you temporarily or permanently prevent a line from loading each time you boot the computer. To remark a line, type REM in front of each line you want to skip.

Tip

If you get errors with an autoexec.bat line, remark the line instead of removing the line, in case it needs to be added again.

Getting additional memory

The following commands help your computer load programs into memory more efficiently, allowing you to have more memory for MS-DOS programs and games.

Make sure you have the three lines below at the beginning of your config.sys file.

DEVICE=C:\Windows\HIMEM.SYS
DOS=HIGH,UMB
DEVICE=C:\Windows\EMM386.EXE NOEMS

By placing the DOS=HIGH,UMB on the second line, this can save memory because it's loading DOS into upper memory before loading the memory manager. Additionally, the first and third lines cannot be loaded into high memory because these lines are the memory managers.

Load all your devices in the config.sys and autoexec.bat into high memory.

Autoexec.bat layout

Below is an example of how the autoexec.bat may look.

@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

The following is common lines found in the autoexec.bat and further information about each of the lines.

@echo off

Tells MS-DOS to read the lines but not echo them or their results back to the screen.

SET SOUND=C:\PROGRA~1\CREATIVE\CTSND

The set sound is telling the computer to send all sound events that the computer may run to that directory containing the sound drivers.

SET BLASTER=A220 I5 D1 H5 P330 E620 T6

Tells the computer to set the Sound Blaster settings, a good line for computer games or other programs needing sound. If you have this line in your autoexec.bat, you have all settings for your sound card. A220 is a port address of 220, I5 is IRQ 5, and D1 is DMA 1. These settings are the typical settings for most sound cards.

SET PATH=C:\Windows;C:\

Sets the computer path to look in the C:\Windows directory or the root if a command used at the prompt is not found.

LH C:\Windows\COMMAND\MSCDEX.EXE /D:123

A line used to load the CD-ROM into the high memory area. If you have Windows 95+, the MSCDEX is in the C:\Windows\COMMAND directory. In Windows 3.x or DOS, this file is in either in C:\DOS or C:\Windows directory. The /D:123 is the name of the driver name that loads in upper memory; this can be anything, usually /D:MSCD0001. Realize that this is not the driver, it is the name of the driver. If you change this line, it needs to also be changed in the config.sys on your CD-ROM line. If the two are not the same, your CD-ROM drive will not load.

LH C:\MOUSE\MOUSE.EXE

Loads the mouse driver into high memory. However, not all mice use the same drivers. Although the mouse may use mouse.exe, it could also be "mouse.com" or "mouse.sys," loaded in the config.sys.

C:\DOS\SMARTDRV.EXE /X

Loads the smartdrive disk cache utility into memory. See the smartdrv command page for additional information about this utility.

DOSKEY

Load doskey into memory so it can be accessed from the command line.

CLS

Run the cls MS-DOS command to clear screen.

WIN

Used for users using Windows 3.x, this line loads automatically Windows when booting the computer. Without this command the computer would only load to the MS-DOS prompt.

Config.sys layout

Below is an example of how the config.sys may look.

DEVICE=C:\Windows\HIMEM.SYS
DOS=HIGH,UMB
DEVICE=C:\Windows\EMM386.EXE NOEMS
FILES=30
STACKS=0,0
BUFFERS=20
DEVICEHIGH=C:\Windows\COMMAND\ANSI.SYS
DEVICEHIGH=C:\MTMCDAI.SYS /D:123

The following are more common lines found in the config.sys file and further information about each of the lines.

DEVICE=C:\Windows\himem.sys

The himem.sys line is an important line; this line lets you load drivers into high memory area. If this line is not present, Windows 3.x will not load.

DOS=HIGH,UMB

Load DOS into high memory in an upper memory block.

Note

This line should be placed after the himem.sys.

DEVICE=C:\Windows\EMM386.EXE NOEMS

The EMM386 line loads the extended memory manager. However, some older MS-DOS games have problems with extended memory and will not run without the NOEMS statement.

FILES=30

The files line allow Windows to load 30 files at the same time. However, going higher may decrease the computer's performance; 30 is found to work the best. Also, make sure the line is one line and that there's not a space between and after the = (equal sign).

STACKS=0,0

The stacks line was first used in MS-DOS 3.2 and was used to swap the stack whenever an asynchronous hardware interrupt occurred. Later in MS-DOS 3.3 the line STACKS=0,0 was added into the config.sys. In special circumstances, this line was changed to STACKS=9,128.

The STACKS statement has a range of 8-64, 32-512. If a higher value is entered, you will receive a "FATAL: Internal stack failure, system halted error."

BUFFERS=20

Buffers line is to load buffers into memory allowing Windows to load memory.

DEVICEHIGH=C:\Windows\COMMAND\ANSI.SYS

The ansi.sys line is a driver for DOS to allow you to have different colors and sizes and special characters at the DOS prompt.

DEVICEHIGH=C:\MTMCDAI.SYS /D:123

The CD-ROM drivers for the CD-ROM drive. The /D:123 represents the name of the driver, which is named 123, however, can be named anything, usually MSCD0001. However, realize that the /D:123 must be the same in config.sys and autoexec.bat. If they are different, the CD-ROM will not work in MS-DOS.

LASTDRIVE=

Lets you specify the last drive installed on the computer. It is not recommended this line be used unless you are using Windows 3.11 or earlier since later version of Windows ignore this line.

FCBS=

A line used to specify the number of file control blocks for file sharing. Should only be used when programs require it, and today, is not used or required. FCBS (File Control Blocks) can utilize between 1 and 255.

Technical support