autoexec.bat

Definition of autoexec.bat in The Network Encyclopedia.

What is autoexec.bat?

A batch file used by the MS-DOS and Microsoft Windows 3.1 operating systems. Autoexec.bat runs immediately after the commands in the config.sys file are executed and can contain any commands that you want carried out when you start your system.

These might include commands to clear the screen of startup messages, to start terminate-and-stay-resident (TSR) programs such as virus checkers, or to define a printer port. Autoexec.bat is typically located in the C:\ directory. Autoexec.bat can also include Path, Prompt, and Set statements for defining the system path and environment variables.

Windows 95 and Windows 98 also include an autoexec.bat file, but it is present only for backward compatibility of running Windows 3.1 applications under Windows 95 or Windows 98.

Note: If an autoexec.bat file exists in the boot partition on a machine running Windows NT, it will be parsed at startup. Any environment variables that are defined in the file will be set, and any path specification will be appended to the default system path whenever the system is started.

Autoexec.bat example

In general, device drivers were loaded in CONFIG.SYS, and programs were loaded in the AUTOEXEC.BAT file. Some devices, such as mice, could be loaded either as a device driver in CONFIG.SYS, or as a TSR in AUTOEXEC.BAT, depending upon the manufacturer.

@ECHO OFF
PROMPT $P$G
PATH C:\DOS;C:\WINDOWS
SET TEMP=C:\TEMP
SET BLASTER=A220 I7 D1 T2
GOTO %CONFIG%
:WIN
LH SMARTDRV.EXE
LH MOUSE.COM /Y
WIN
GOTO END
:XMS
LH SMARTDRV.EXE
LH DOSKEY
GOTO END
:END

AUTOEXEC.BAT was present in MS-DOS, windows 3.1, 95, 98 and XP operating systems.