A batch file is a script file in DOS, OS/2, and Microsoft Windows. It consists of a series of commands to be executed by the command-line interpreter, stored in a plain text file.
How to create a batch file?
Creating a batch (.bat) file is easy, and it can help you run various commands without typing them again and again.
Few examples for which you can use a batch file for cleaning temp files, shutdown computer with only one push, refresh&change IP/gateway, and there’s much more you can do with this.
At first, this’s short information before how to do that. Batch files are not applications; these are the command series that execute more than one MS-DOS command. Now, this’s instruction for how to create the batch file;
- Open Windows Search and type Notepad and then click to open it
- Write the command series which you want to execute. Example:
xcopy C:\data\*.*/s d:\backup
- Now, Go to the File tab and click save as.
- Now, you should define a name and extension. The most crucial step is, you should give an extension to this file as “.bat.” Exp.: backup.bat
- You can see below, there’s several Save as types. Please choose All Files and save by save button.
And done head over to the file located which you selected for the backup.bat files and double click it, When you execute this file, it’ll start to copy C:\data content to D:\backup folder.
This way, you can efficiently execute any command you would like to perform.