Discover everything you can do with a BAT file and how this type of file allows you to automate your commands in Windows.In this guide I’m going to explain what a BAT file is, how you can create one in Windows 11, and what you’ll need to have one for. For now, I’ll tell you in advance that, if you’re looking for a way to run batch commands , what I’m telling you here will be of great interest to you. Discover all the ins and outs of one of the most unknown files in the Windows world and learn everything you can do with a BAT file.
What is a BAT file?
A BAT file is a plain text file that allows the user to run multiple CMD commands at once . Its name comes from batch . The term batch is often used in computing with the idea of completing multiple tasks with a single request. For example, in Windows, if you select multiple files and rename them, they are all named the same, although each one has a number to generate a series. The user is only making one request, namely renaming a file. However, the operating system understands that it must apply the same action to all the selected files, executing the same task in batch .
On the Internet it is easy to find all kinds of “batch” programs, which are responsible for completing many terabytes in batches. Without going any further, there is Bulk Renamer Utility , which changes the name of many files at the same time (just like Windows does, by the way). There is also Image Resizer , from PowerToys , which is capable of changing the size of many images at the same time. I give you all these examples so that the concept is clear.
Back to the BAT file, it is a very old type of file, present since the earliest versions of Windows . In fact, I used them myself back in the days of Windows 95. It hasn’t been a long time since then! As I said, its purpose is to execute a list of CMD commands one after another . This helps you save a lot of time, especially when you have to repeatedly execute certain tasks using the command line.
Use cases for BAT file
Here are some practical cases where a BAT file comes in handy:
- Create file backups . A command can be set up to copy the contents of one folder to another. With just one click, CMD would take care of executing this and other associated tasks, such as deleting the original folder.
- File Management . Within a BAT file you can include several commands to decompress a source file on your PC, copy the resulting files to a destination folder, and delete the original file.
- Improving PC performance . By using various commands, such as SFC , CHKDSK or DISM, all run in batches, it is possible to recover some damaged files and diagnose problems on the hard drive.
- Run any application command . I use a BAT file to run rclone and create a daily backup of Google Drive. I also created the file inside the Startup folder so that the commands are executed when I start the computer. Here is a guide where I explain how to make a program start with your computer .
How to create a BAT file step by step
CMD commands are generally more useful to advanced users. This has led to the BAT file becoming less popular. However, you may be interested in generating your own to launch various commands in batches. How can you do it? It’s very simple.
The first thing is to generate a new text file . Use the option you have in the Windows context menu.Then, rename the file using the name you prefer. It is also important that you change the extension from TXT to BAT. If you don’t see the extension, take a look at the guide on how to see file extensions in Windows .
Confirm the extension change by pressing Yes in the pop-up window.Next, right-click on the BAT file (which should have changed its icon by now) and select the Edit in Notepad option .
Using Notepad , enter the commands you want to run. In this example, I’m creating a file to close Microsoft Edge. When this has happened, CMD will return a message and wait for me to press a key to continue. For the latter, I’ve used the pause command .
Finally, save the changes to the BAT file. Now just double-click it to test it.
As shown in the image above, CMD first executes the command that terminates Edge processes, then sends me the message set with the echo command , and finally pauses waiting for me to press a key. If there were more commands after the pause, the console would start executing them. As is not the case, pressing a key closes CMD.
And you, what use do you see for the BAT file? Leave me your comment below. I’ll read you in the comments!

