In this article, I am going to teach teach you what a batch file is and how to create one. What is a batch file?
A batch file is a text file saved in .bat
format with a number of commands written in it. For example, you want to run a game but before that, open another file (which is a notepad file) which contains all the cheat codes of the game within it. In such a case, you can first write the command to open the notepad file and after that, using a command to open the game. In this way, the precess becomes time consuming.
A batch file can either be a notepad file or a word pad file. But, the thing is that it is stored in .bat
format so that the computer knows the difference between a text file and a batch file and avoid opening it in the text form.
The batch file got its name since it executes commands in batches
.How to create a batch file :
Suppose that you want to open a game (say dangerous dave) and after closing it, you want to open the Mozilla Firefox browser automatically. In such a case, you need to do two tasks (functions) by initiating only once. Hence, you will need to create a batch file.
In order to do so, follow the steps below : (Considering dave.exe is used to open Dave and firefox.exe is the executable file to open Firefox.)
1. Open either a notepad or a word pad file.
2. Type the following in it:
3. Go to file and click save as
. Select file type as all files
4. Give the name of the file yourname.bat
5. Save it wherever you want it to be saved. Close the notepad or word pad.
That's it. A batch file will be created successfully. Now, whenever you open that file with .bat
extension, the dave game will open first and as soon as you close the game, the Firefox browser will open successively.Advantages of using a batch file :
- It is a time consuming process. Every time, you need not open the files separately. Opening the batch file once will do all the functions given in it.
- The sequence of doing a specific function is not needed to be remembered. Once you create the batch file, you can do all the functions in the future.
- It is a good, effective and faster way of communicating with the command shell (or to the system).
So it is good to use a batch file to complete your work much simpler.
Thanks for reading. Hope this article has helped you!
Also read Play Age of Empires 2 in Windows 7 and later version - Using Batch file
*** Please do not forget to leave your comments about this article ***