Batch Script

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
Share this:

Techopedia Deals

Connect with us

Techopedia on Linkedin
Techopedia on Linkedin
"Techopedia" on Twitter

Sign up for Techopedia's Free Newsletter!

Email Newsletter

Join thousands of others with our weekly newsletter

The 4th Era of IT Infrastructure: Superconverged Systems
The 4th Era of IT Infrastructure: Superconverged Systems:
Learn the benefits and limitations of the 3 generations of IT infrastructure – siloed, converged and hyperconverged – and discover how the 4th...
Approaches and Benefits of Network Virtualization
Approaches and Benefits of Network Virtualization:
Businesses today aspire to achieve a software-defined datacenter (SDDC) to enhance business agility and reduce operational complexity. However, the...
Free E-Book: Public Cloud Guide
Free E-Book: Public Cloud Guide:
This white paper is for leaders of Operations, Engineering, or Infrastructure teams who are creating or executing an IT roadmap.
Free Tool: Virtual Health Monitor
Free Tool: Virtual Health Monitor:
Virtual Health Monitor is a free virtualization monitoring and reporting tool for VMware, Hyper-V, RHEV, and XenServer environments.
Free 30 Day Trial – Turbonomic
Free 30 Day Trial – Turbonomic:
Turbonomic delivers an autonomic platform where virtual and cloud environments self-manage in real-time to assure application performance.