How to create a batch file? The Easy Way!

Sophie Luo, in Technical Tips

Batch file is a computer file containing a list of instructions to be carried out in turn.

For example, you need to constantly run several commands to refresh your network settings, and repeating the same procedure over and over again could be time consuming. Or there are a number of websites that you need to open in order to work, and it could be annoying to have to open them one by one every time. A batch file can help you solve the headache.  

In this post, we will show you how to easily create your own batch file to make things so much easier! 

Basically, you just need to do the following things to create a batch file that automatically runs the commands: 

1) Open a Notepad, or a Notepad++ document, but not a Word document; 

2) Bear in mind basic commands: 

echo: The ON or OFF option for ECHO turns the echoing feature on or off. If the ECHO is on, the CMD will display the command executing.

pause: Stop the running of Windows batch file; 

start “” [website]: Go to website using your default browser. 

3) Save your file with the file extension .bat

4) Double click to run the batch file and right click and choose Edit for further edit. 

As mentioned above, a batch file can help you troubleshoot frequent network issue. You may be aware that you need to type in ipconfig and some other commands to run the troubleshoot, but you don’t have to do it again and again whenever you have network issues. Let’s see how a batch file helps you with that! 

1) Right click on a blank space on your desktop and select New, and then choose Text Document from the list. 

2) Double click to open the text document. Then type in the following commands: 

ECHO OFF
ipconfig
ipconfig /flushdns

ping google.com
tracert google.com
PAUSE

When you finish typing the commands, choose Save as… and then changed the file name to a name ends with .bat (we go with network_diagnose.bat) and sve the file type as All Files. Then hit Save button. 

3) When double click to open the newly created batch file, you will see it automatically running the command that you just type in. When the commands finish running, hit any keys to pause and exit. 

NOTE: There are many more commands in Windows that you can create a batch file with. If you need, just look for them in search engine and repeat the above procedure to create a batch file fast and easily! 

Another handy usage of batch file is that it opens your favored websites all at once when you run it. Here is how you do it: 

1) Right click on a blank space on your desktop and select New, and then choose Text Document from the list. 

2) Then open the newly created document. In the document, copy and paste in your favored websites’ names with start “” in front of them. The screen shot here is just an example. 

3) Hit the File button on top and choose Save as…

3) Change the file name as you like it with .bat in the end and then choose the save the file as All Files type. Hit Save button. 

4) Now double click the newly created batch file and you will see the websites all open automatically using your default browser. 

Easy and handy, right? Batch scripts are there for you to help you with all the tedious work that needs to be done over and over and over. Free your head and see what you can do with it now! 

Help Us Improve Article