How to create Batch file?

Batch files are the computer handyman’s way of getting things done. They can automate everyday tasks, shorten the required time to do something, and translate a complex process into something anyone could operate.
Since automation programs like AutoHotKey exist, many people have never written or taken the time to understand bat files, and many don’t even know what they do.
In this article, I’m going to show you how to write a simple batch file and present some basics that a user will need to understand when writing one. I’ll also provide you with a few resources for learning to write batch (.bat) files in case you’d like to go further.


Let’s say that you frequently have network issues; you’re constantly getting on the command prompt and typing in things like “ipconfig” and pinging Google to see what the problem is. After a while you realize that it would be a bit more efficient if you just wrote a simple BAT file, stuck it on your USB stick, and used it on the machines you troubleshoot.

Step 1: Create A BAT File

Create a new text document on your desktop. Double click the file – it should be blank inside. Now, go to file>save as, and in the “Save As” window, input a name for your BAT file and then add a “.bat” on the end (without the quotes). My file was named testBAT.bat, for instance.
Before hitting save we need make sure that Windows doesn’t stick the standard “.txt” ending on the end of our new file. To do this, change the filetype from “.txt” to “all files” as shown in the screenshot below. That’s it – hit save and close the file.

No comments: