How to Create Batch Files

Techwalla may earn compensation through affiliate links in this story.

Batch files are components of the Windows operating system that automate functionality by scripting common system tasks. Batch files are text files that use MS DOS commands and are capable of basic flow control. This allows batch scripts to run commands and take actions based upon sets of conditions, such as the time of day. Every Windows system is capable of using creating and using batch files.

Step 1

Press the Start button on the system task bar.

Step 2

Select "Run" if you are using Windows XP or earlier. Click the search bar of the Start menu if you are running Windows Vista or later.

Step 3

Type "Notepad" without quotes and press "Enter."

Step 4

Write commands in the text editor as you would from the command prompt. The command and control lists for batch scripting are extensive; see Resources for a list.

Step 5

Click "File" then "Save As" and save the file as "FileName.bat" with quotes included. This tells Notepad to save it as a batch file and not a text file. Replace FileName with the name you wish to use for your new file.

Step 6

Double-click the file you saved to run it; this creates your batch file.

Things You'll Need

  • Microsoft Windows

  • Notepad or other text editor

references & resources