What are Batch Files?
If you work on a computer then you must be fully aware with the features of Batch Files. But, we are just aware of Batch files as hardly anyone uses them. They belong to some underdog features category of computer, that haven’t gotten well deserving attention yet. But, today we are going to rectify this by providing much deserving attention to them.
For starter’s, Batch files are created to aid users to handle complex features without any hassle. You can automate your everyday task resulting in lesser time consumption for doing the task with the batch files. For example, if you want to switch between two OS then with the batch file, you can easily switch. As normally, it requires few minutes to switch between two OS.
Due to some preinstalled commands, we never pay attention towards batch files. But, let’s change this as creating a batch file is a super easy task and a shortcut to success.
How write Batch File?
Well, writing a batch file that follows your command isn’t a difficult task. You can create your batch file using two easy steps.
Create empty Batch(.bat) file using word editor.
Okay, open word editor on your computer like notepad. Start creating a new text document in ‘Word’. Click on the save as option, remember that batch is empty at this point as we haven’t inserted any coding. Give a name to your batch file and change the file extension from .txt to .bat. Save as “All Files” in your system and close the document.
Add Coding command to an empty batch file.
Now, we are going to add functional commands to the empty batch file previously created. Right-click on the file and select edit option. A blank screen will appear to add codes to it. Before writing, codes make sure to draw a rough blueprint of the command, so that no error occurs while running the command. Once you are satisfied with the code press ‘Save’. After that double-click on the ipconfig.bat file to run it and your PC will show the IP details as soon as you press any key.
5 Batch commands every beginner should know.
So, before creating your own batch file, you need to get acquiescent with the batch commands. There aren’t many batch commands present, so by having knowledge of these 5 batch commands you are good to go.
- TITLE– Title command carries the name of your batch file. The Title command is the address of your batch file.
- ECHO– You have used the print command in programming, then ECHO works similar to it. ECHO is used to display any text or comment in command prompt.
- ECHO OFF– This is an optional command which turn offs already running the command. This command is used by a developer on their personal interest.
- PAUSE– The PAUSE command waits up for the user to press a key before exiting the Windows or executing/running the next command. This command is highly recommended as without this command program will automatically be executed or will become hard to relocate it.
- IPconfig– This command shows the IP address of your computer and works very well in Windows 8. As with the IPconfig command, you don’t have to go through the hassle of command prompt window and entering the command each time. You can simply run this command to configure IP address of your computer.