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
- Open Notepad.
- Enter the command
- 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
- at the top of the batch file.
- Select Save As from the file menu.
- Enter the batch file’s name as
- Be sure to enter the name in quotes, or Notepad will add .txt to the end.
- Run cmd.exe to start a command session.
- Enter the batch file’s name, without the extension.