The AUTOEXEC.BAT
file
AUTOEXEC.BAT stands for automatic execution batch file, as in start-up automatically when the computer is turned on. Once a very important part of the operating system, it is being less used and is slowly disapearing from Windows. It is still powerful and useful. In NT versions it is called AUTOEXEC.NT, click here for more information.
Before the graphical user interface(GUI, "gooey") of Windows, turning on a PC would an enegmatic C:\>
and not much else. Most computer users used the same programs over-and-over, or only one program at all. DOS had a batch file which set certain system environments on boot-up. Because this was a batch file, it was possible to edit it and add a line to start-up the user"s programs automatically.
When the first version of Windows was released users would turn their PCs on, and then type: WIN or WINDOWS at the prompt invoking the Windows interface. The next version of Windows added a line to the AUTOEXEC to start Windows right away. Exiting from Windows, brought one to the DOS prompt. This automatic invocation of Windows made a lot of people mad. Anyone who knew how to edit batch files would remove that line from the AUTOEXEC to keep Windows from controling the Computer. Most users do not even know that DOS is there now and have never seen it as Windows hides the any scrolling DOS with their fluffy-cloud screen. At work I will often have to troubleshoot a PC by openning a DOS shell, the user"s often panic, believing that I have broken their machine because the screen "turns black".
Most current versions of Windows have a folder called "Start-up." Any program or shortcut to a program placed in this folder will start automatically when the computer is turned on. This is much easier for most users to handle than editing batch files.
Old versions of DOS had a AUTOEXEC that looked like this:
All this really did way set the DOS prompt to ">"
Later versions looked like this:
cls @echo off path c:\dos;c:\windows set temp=c:\temp Lh mouse Lh doskey Lh mode LPT1 retry
|
This AUTOEXEC.BAT loads DOS & then Windows. Sets up a "temp" directory. Loads the mouse driver, sets DOSKEY as the default and sets the printer retry mode. "Lh" stands for Load High, as in high memory.
An AUTOEXEC.BAT from a Windows 3.11 Machine
@ECHO On rem C:\WINDOWS\SMARTDRV.EXE C:\WINDOWS\SMARTDRV.EXE 2038 512 PROMPT $p$g PATH C:\DOS;C:\WINDOWS;C:\LWORKS;C:\EXPLORER.4LC SET TEMP=C:\DOS MODE LPT1:,,P >nul C:\DOS\SHARE.EXE /F:150 /L:1500 C:\WINDOWS\mouse.COM /Y cd windows WIN
|
This version simply sets DOS to boot to Windows.
SET HOMEDRIVE=C: SET HOMEPATH=\WINDOWS
|
Whenever a program is installed on a computer, the setup program or wizard will often edit the AUTOEXEC. Many developer studios will have to "set a path" so programs can be compiled or run from any folder. This AUTOEXEC is an example of that:
SET PATH=C:\FSC\PCOBOL32;C:\SPRY\BIN SET PATH=C:\Cafe\BIN;C:\Cafe\JAVA\BIN;%PATH% SET HOMEDRIVE=C: SET HOMEPATH=\WINDOWS
|
This AUTOEXEC sets the path for COBOL and JAVA development BINs. This way, the computer knows where to look for associated files for COBOL and JAVA files if they are not located directly in a BIN folder.
Sets all the devices and boots to Windows.
When the "REM" tags are removed the device commands become visible.
@SET PATH=C:C:\PROGRA~1\MICROS~1\OFFICE;%PATH% REM [Header] @ECHO ON REM [CD-ROM Drive] REM MSCDEX.EXE /D:OEMCD001 /L:Z REM [] REM MODE CON: COLS=80 LINES=25 REM [Sound, MIDI, or Video Capture Card] REM SOUNDTST.COM REM [Mouse] REM MOUSE.COM REM [Miscellaneous] REM FACTORY.COM
|
For loading Windows from a CD
@echo off MSCDEX.EXE /D:OEMCD001 /L:D d: cd \win95 oemsetup /k "a:\drvcopy.inf"
|
For loading CDROM drivers
Removing the "REM" tags uncomments the commands and runs them.
REM MSCDEX.EXE /D:OEMCD001 /l:d REM MOUSE.EXE
|