What is an AUTOEXEC.BAT file?
An AUTOEXEC.BAT file contains MS-DOS commands which are executed automatically when a Personal Computer boots. This file is usually located in the root directory of the hard drive or floppy from which the computer boots (or starts) up. The AUTOEXEC.BAT file is used to set various default settings and to run programs that should be executed upon startup. Below you will find a list of executable statements (commands) that typically go into an AUTOEXEC.BAT file, along with explanations their.
The AUTOEXEC.BAT file is one form of a batch file, and it is used to automate functions in MS-DOS. In their simplest form, batch files contain MS-DOS commands (batch file language) which includes commands for such things as loops and execution branches and the like.
Example: @ECHO OFF
This optional command will suppress the display of subsequent commands while the AUTOEXEC.BAT file is being executed. You can also use ECHO to display lines of text.
PATH C:\;C:\DOS;C:\WINDOWS;C:\SOUND\ADD\BIN; C:\SOUND\SB419F
At times, you may see the command in the form SET, such as in SET PATH, or PATH = . Both are valid forms of the command.
Use the PATH command to tell MS-DOS which directories to look into when an executable file is not in the current directory. When you enter a line of text at the MS-DOS prompt that is neither a recognized command nor an executable filename in the current directory, MS-DOS will search through the directories in your PATH for a filename that matches the text you entered. This command is recommended unless you are using a menu shell. Many packages, such as WordPerfect, automatically add or modify the PATH line during the installation process. The path cannot exceed 127 characters, and may be further limited by your MS-DOS environment space.
Note: The example PATH command shown above should actually be placed on a single line in the AUTOEXEC.BAT file, with the line wrapping around rather than being interrupted by carriage returns.
Sometimes you might see more than one PATH command in AUTOEXEC.BAT. The second and subsequent PATH commands might have the form:
%PATH% represents the existing path. This example would add C:\BLASTER to the path.
If you enter PATH at the C:\ prompt, the current path will be displayed. This can be a good troubleshooting tool, as it can tell you if the PATH command in AUTOEXEC.BAT has become too long and has become truncated.
SET BLASTER=A220 I5 D1 T1
SET is used to set system variables, which are used to pass information to programs. In these examples, the command is used to tell programs in what directories to store certain files or where configuration files are kept. Some programs, such as Windows, will set up this statement during the installation process, and many programs require SET statement entries in the AUTOEXEC.BAT file to run correctly. In some cases, a backslash following the end of a directory name is required, and spaces at the end of a line may cause trouble.
If you enter SET at the C:\ prompt, all the system variables will be displayed.
Use the PROMPT command to alter the default DOS prompt. This particular example makes the DOS prompt display the current path and drive, and is very useful.
CLSCLS clears the screen.
Note: You should only create or edit a DOS text file with a DOS editor such as EDIT, EDLIN, or TED. If you use a word processing program, make absolutely sure that you save the file in text (ASCII) format, rather than any special file format that the word processor normally uses.
Copyright ©1998 DEW Associates Corporation. All rights reserved.