In MS-DOS, OS/2, and Windows, a batch file is a text file containing a series of commands intended to be executed by the command interpreter. When a batch file is run, the shell program (usually COMMAND.COM or cmd.exe) reads the file and executes its commands, normally line-by-line. A batch file is analogous to a shell script in Unix-like operating systems.
Batch files are useful for running a sequence of executables automatically. Many system administrators use them to automate tedious processes.
Although batch files support elementary program flow commands such as if and goto, they are not well-suited for general-purpose programming.
DOS batch files have the filename extension .BAT. Batch files for other environments may have different extensions, e.g. .CMD in Windows NT and OS/2, or .BTM in 4DOS and related shells.