Definition - What does Batch Script mean?
A batch script is a text file that contains certain commands that are executed in sequence. It is used to simplify certain repetitive tasks or routines in the Windows, DOS and OS/2 operating systems, and is also used in complex network and system administration.
A batch script has a file extension of .bat, .cmd or .btm.
Techopedia explains Batch Script
The commands in a batch file are executed by a special interface or shell. These commands may include "goto," "for," "call," "echo," "setlocal," etc., and may make use of decision and loop constructs. A batch script can be created using any text editor such as Notepad or WordPad, and must be saved only in plain text format.
A batch file can be run easily by clicking on it or by typing its name in a command line interpreter. A batch script can also be run with arguments. The following are some of the commonly used commands in a batch script:
- Echo — To display some text on the screen
- Call — To run a batch script from within another script
- Goto — To transfer control or execution sequence to a label or subroutine
- If — To test a condition
- Pause — To wait until a key is pressed
- Rem — To include a comment line in the script
- Setlocal — To start a local environment
- Endlocal — To terminate a local environment
- Shift — To parse the command line arguments in the script
- Start — To run a script with a default application
- Xcopy — To copy files and folders