

The top portion of the batch file uses special batch file commands that will be covered in this unit. It is made up of the commands to copy com files from the C drive to the \111\com as a backup.

This example represents a modest batch file. Computer users would have the autoexec file set up the system date and time, initialize the MS-DOS environment, load any resident programs or device drivers, or initialize network connections and assignments.

When MS-DOS loads, the file AUTOEXEC.BAT is automatically executed, so any commands that need to be run to set up the MS-DOS environment for use could be placed in this file. In MS-DOS, a batch file can be started from the command line by typing its name followed by any required parameters and pressing the "enter" key.

Once introduced to your system, batch files basically become DOS commands for your system. The contain a series of DOS commands just as if you were typing them in by hand at the DOS prompt. Although batch files support elementary program flow commands such as if and goto, they are not well-suited for general-purpose programming. Many system administrators use them to automate tedious processes. Batch files are useful for running a series of executables automatically. When a batch file is run, the shell program (usually CMD.EXE or COMMAND.COM) reads the file and executes its commands, normally line-by-line. In MS-DOS and Windows, a batch file is a text file containing a series of commands intended to be executed by the command interpreter. The more you know about MS-DOS, the better prepared you will be to understand the CLI of Windows. The commands and concepts of the command line interface (CLI) of Windows are based on the use of MS-DOS commands for backwards compatibility. Learning objective: (2) Explain the purpose of a batch fileĪs you go through this unit, keep in mind that we are not learning MS-DOS but the command line interface of Windows which is *based* on MS-DOS.
