Definition of autoexec.bat in Network Encyclopedia.
What is autoexec.bat?
Autoexec.bat is 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 to be 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.
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.
SET BLASTER=A220 I7 D1 T2
LH MOUSE.COM /Y
To edit Autoexec.bat can be modified using the MS-DOS command edit (MS-DOS text editor). Type edit c:\autoexec.bat to edit the autoexec.bat file.
If the mouse drivers are not loaded properly, the mouse will not work.
If you have Windows 95, Windows 98, or later versions of Windows it is recommended that you use the sysedit command; to run this program, click Start, Run, and type sysedit.
Windows XP and later no longer use the autoexec.bat or config.sys file.
Autoexec.bat commands explained
@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 DOSKEY CLS WIN
|@echo off||Tells DOS to read the lines but not echo them 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.|
|SET BLASTER=A220 I5 D1 H5 P330 E620 T6||Tells the computer to set the Sound Blaster settings, which is 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 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 for the CD-ROM. If you have Windows 95+, the MSCDEX will always be in the C:\Windows\COMMAND. 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. Keep in mind 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 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,” which is 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||DOS command to load DOSKEY into memory.|
|CLS||MS-DOS command to clear screen.|
|WIN||Used for users using Windows 3.x, this line will load Windows automatically when booting the computer.|
AUTOEXEC.BAT was present in MS-DOS, windows 3.1, 95, 98 and XP operating systems.