Batch files are .bat extension files that have a special command line to perform a specific task. Once run, there is a sequence of commands that take action with the command prompt. You can either perform specific tasks or change the system setting by using a batch file. Though there is a one time hassle of typing it. To get a seamless experience one should have a grip over the command line. This article will act as a push start for interested readers.
Note – This article will only teach how to start and execute a batch file as the topic is very vast and needs some level of coding experience to master.
How to create a batch file
The process is fairly easy. All you need is a text editor to start with. You must also have some basic knowledge to create and craft command prompt executables. Follow the below steps.
Step 1 – Press start
Step 2 – Search for a notepad or use professional coding tools like Notepad ++.
Step 3 – Type in the below program
ECHO Your first batch file was executed successfully.
Meaning of keywords:
- @ECHO OFF – Display the content in a clean line disabling the display prompt.
- ECHO – Prints the text after a space on the screen.
- PAUSE – The CMD will still be running even after the command has been successfully executed.
Step 4 – Click on File and then Save As
Step 5 – Save the extension as .bat. (Example – First.bat)
How to run the batch file
Step 1 – Press Start and search command prompt (Run as administrator).
Step 2 – Now input the path of your bat file for our case the file is on the desktop so we will input the following command.
Step 3 – Press enter to execute the file
Another alternative is to right-click the bat file and run as administrator. It will ask the permission of the Command prompt to grant it to gain similar results. With this, we come to the end of this article. There are a lot of uses for a batch file like scheduling to perform a particular task at a particular time or enabling system setting at a particular course of action. One can also create batch file to run command. but for that, one must have a grasp over CMD commands.
For the latest gadget and tech news, and gadget reviews, follow us on Twitter, Facebook and Instagram. For newest tech & gadget videos subscribe to our YouTube Channel. You can also stay up to date using the Gadget Bridge Android App. You can find the latest car and bike news here.