What is a batch file?

Learn what a batch file is.

John Savill

January 8, 2000

1 Min Read
ITPro Today logo in a gray background | ITPro Today

A. A batch file is a text file with a .bat or .cmd extension. A batch file adheres to a syntax and a set of valid commands or instructions. To run a batch file, enter the file’s name. You don't need to enter the .cmd or .bat extension. To write a basic batch file, perform the following steps.

@echo hello world@echo off".cmd"
@echo off
".cmd"
  1. Open Notepad.

  2. Enter the command

  3. Text that follows the echo command will output to the screen. The @ symbol suppresses the command from printing to the screen. To prevent commands from displaying for an entire batch file, enter

  4. at the top of the batch file.

  5. Select Save As from the file menu.

  6. Enter the batch file’s name as

  7. Be sure to enter the name in quotes, or Notepad will add .txt to the end.

  8. Run cmd.exe to start a command session.

  9. Enter the batch file’s name, without the extension.

About the Author

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like