Batch file
Under the MS-DOS operating system, a batch file is a text file with a series of commands (see command line interface). When the batch file is run, in the same way as ordinary executables, the commands in the file are executed in order.
A batch file is equivalent to a shell script under Unix.
DOS batch files have the filename extension .BAT
. If a file named AUTOEXEC.BAT
exists during startup, it is executed.
The default behaviour of command.com is to print each command to standard output before executing it. This is most often not desired, so the command ECHO OFF
is given at the beginning of a batch file to prevent that from happening. Command.com also has the operator @
, which may be prefixed to a single command to keep that from printing. Thus, almost all batch files start with the line @ECHO OFF
.