With the convenience of pre-installed software on Windows today, there are many unique and beautiful tools that are forgotten. Using BAT files on Windows is also one of those tools. In fact, the use of BAT files on Windows is mostly only for those who are enthusiastic, tinkering with computers more than using it for work and ordinary purposes. Moreover, using a BAT file on Windows is not simple because it has to run through pre-programmed commands, something that very few people can learn and do.
If we talk about .BAT file we can apply it to a lot of things on the computer that you may not know about, such as creating a .BAT file to shut down the computer is an example. There are many ways to shut down a computer such as using the Run tool, the Command Prompt and
How to create and use a BAT file on a Windows computer
What is a BAT file?
The BAT file or full name Batch is a programming language that is based on batch executable files (*.bat, *.cmd,…) to run. They will be executed in the form of a cmd – Command Prompt window to run the command line. Batch has a lot of functions and using BAT files on Windows incorrectly can erase everything from data, hard drive or damage the operating system itself.
How to create a BAT file on Windows
Step 1: To create a very simple BAT file, you just need to right-click on any empty space then select New >Text Document.
Step 2: Here you enter any content and command for the file as long as there is text and then click File > select Save As.
Step 3: In the File name section, name the file, as long as the last letter must be.BAT and in the Save as Type section we select All Files.
If there is a warning about text formatting, just ignore it and click OK .
Finally you will see your BAT file in the shape of a gear, the creation of the BAT file is complete.
How basic commands are used for BAT files
In fact, the BAT file has many commands and to use the BAT file on Windows fluently is not a simple task, but for newcomers to using BAT files on Windows, you can take a look at the following commands to know briefly how to use BAT.
– Tittle: The window name for the BAT file.
Echo: The command to print the BAT file, any information after the echo will be displayed in the Command Prompt.
Echo off: Placed at the top of the BAT file, the commands below this statement will not be executed.
– Pause: Used to pause the command in BAT until a restart.
– cls: Delete all text that is displayed on the screen when you have entered too many operations. This command is the same as Clear on the Command Prompt.
– ipconfig: Check IP address and related parameters
– ping: ping to an IP address, indicating whether it responds quickly or slowly, e.g. ping taimienphi.vn
Shutdown: A command used to shut down the machine, such as shutdown -s -t 500 (which shuts down the computer in 500 seconds).
Write content and use BAT files on Windows
Step 1: We can create a BAT file like the above and write the content directly, but in case there is already a BAT file, just right-click and select Edit to proceed with editing and writing content for the BAT file.
Step 2: Here you try to write a command, for example but ping a web address that the Software cited above. For example, ping the Software address we will write the following command:
ping www.taimienphi.vn -t
With Ping is the command used to test the response of the website.
– t is the time, when adding -t to the system will automatically ping forever non-stop until you turn it off.
Step 3: Then select File > Save to save this BAT file to.
Step 4: Double-click on that BAT file to run it and you will see that the system will automatically run the ping command you gave above.
Step 5: Another example is to use the shutdown command to shut down, which is a fairly familiar command on your computer that helps you set a shutdown timer. Similarly, you enter the command as follows:
Shutdown -s -t 500
With shutdown is the command used to shut down the computer.
– s is the shutdown command with s being shutdown.
-t is the time with 500 measured in seconds (500 seconds).
The system will immediately display a message that the computer will be turned off after 500 seconds (8 minutes).
Other applications when using BAT files on Windows
Above are just the very basic ways to use BAT files on Windwos to help readers understand more about this tool, there are many uses and features that you do not know about BAT files.
– For example, we can create a BAT file to delete files and folders on the computer. This is a feature that the file can completely do if you have ever used the Command Prompt, know how to use it through the Command Prompt, you can also understand how to do it. See more articles
– Or create a BAT file that fixes Full Disk errors, an extremely annoying error to users but if you apply
– Or a more advanced trick than the BAT file application is to set a folder password in the computer. This is an advanced trick with many complex commands, you do not need to know too much about code to use this way. Just copy the reference code in the article
Through the article on Software, hope you have understood more about BAT files as well as how to use BAT files on Windows mentioned in the article. If you explore more about the BAT file, you will see that there are many things you can do with the BAT file above.
https://thuthuat.taimienphi.vn/cach-tao-va-su-dung-file-bat-tren-may-tinh-windows-34659n.aspx
In addition to the BAT file, the Command Prompt (CMD) is also a tool that comes pre-installed on Windows but very few people pay attention. But if you are proficient or know how to use Command Prompt 1 you will find this tool extremely useful, refer to common CMD commands in your computer that you should know here to understand more about Command Prompt or Powershell on Windows 10.