A batch file (or BAT) represents a script file that stores a series of commands to be executed in a serial order. These files are often used to load programs, run multiple simultaneous processes, or automate repetitive tasks. Contrary to popular belief, creating BAT files does not require advanced computer skills.
If you want to learn how to create a BAT file, look no further. This article provides detailed step-by-step instructions on how to create different BAT files.
How to create a BAT file Windows 11
Creating BAT files in Windows doesn’t have to be complicated. Here’s how to create a basic BAT file:
- Open the Start menu, start typing “Notepad” and open it.

- Write these lines to the text file:
“@ECHO OFF“.
ECHO Hello and welcome to batch scripting! If you’re seeing this text, it means you’ve successfully created a BAT file in Windows. Great job!
PAUSE
- Select File.”

- Choose “Save As.”

- Name the file. We recommend “Test Bat” or something similar. Remember that you will need to add “.bat” to the end of the file name because it will not work without it. Also, make sure “All files” is selected next to “Save as type.” Save the file to the desired location.

- Find the file and open it to test it. You should see a command window with this text: “Hello and welcome to Batch Scripts! If you see this text, you have successfully created a BAT file in Windows. Great job!”

How to create a BAT file to move files
BAT files can move one or more files from one folder to another. To create one, you’ll need to find the appropriate folder paths that make the transfer possible. Follow the instructions below to find and copy folder paths:
- Find the folder you want to move files from and right-click on it.

- Select “Properties.”

- Copy the text to the right of “Location.” For example, “C:\Users\User”.

- Open the Notepad app and paste the text.

- Locate the destination folder and right click on it.

- Choose “Properties.”

- Copy the text next to “Location.” For example, “C:\Users\User\Desktop”.

- Paste the text below the source folder location.

Now that you have the folder paths, it’s time to create the file:
- Type the following text in Notepad:
“@ECHO OFF“.
move Source-Path*.* Destination-Path
“Source Path” is the location of the source folder, while “Destination Path” is the location of the destination folder. Remember that if any part of a folder path has two or more words, you must put that part in quotes.
- Press “File.”

- Select “Save As.”

- Name the file and save it to the desired location. When naming the file, insert “.bat” at the end, for example, “move.bat”. Also, select “All files” in the “Save as type” box.

- Open the BAT file and the files in the source folder will be automatically moved to the destination folder.

How to create a BAT file to run a command
With BAT files, you can execute numerous commands. All you need to do is find the appropriate syntax for the request you want to execute. These are some of the popular ones:
- DEL: This command deletes files.
- REN: This command renames files and directories.
- TIME: This command displays or sets the time.
- CHKDSK – This command scans the disk for possible problems.
- EXPAND – This command extracts files from compressed archives.
Let’s try the command to delete a file. Here’s how to use it:
- Open Notepad.

- Write the following text:
“@ECHO OFF“.
DEL [file destination and name]
- Select File.”

- Choose “Save As.”

- Name the file and save it. When naming the file, write “.bat” at the end; otherwise the command will not work. For example, call the file “delete.bat”. Choose “All files” in the “Save as type” box.

- Run the BAT file and the file whose destination and name you entered will be deleted automatically.

How to create a BAT file to copy files
With a BAT file, you can copy and paste files from one folder to another. Just like moving files, you’ll need to know the location of the file to copy and paste it. This is what you should do:
- Find the file you want to copy and right-click on it.

- Choose “Properties” and copy the file location.

- Repeat the steps to save the destination folder location.
- Open Notepad.

- Write the following lines:
“ECHO OFF“.
copy [source] [destination]
- Choose the file.”

- Select “Save As.”

- Name the file and save it to a folder of your choice. Naming the file correctly is crucial to creating a successful BAT file. Use “.bat” at the end of the file name because it cannot work without it. For example, “copy.bat”. Select “All files” in the “Save as type” box.

- Open the file and the file whose location you entered will be copied to the desired destination.

How to create a BAT file to map a network drive
If you want to create a BAT file to map a network drive, follow the instructions below:
- Open the Start menu, start typing “Notepad” and open it.

- Write the following lines:
“ECHO Create new [drive letter] drive mapping“.
@net use [drive letter]:\Network path/persistent: yes
:exit
@pause
- Choose the file.”

- Press “Save As.”

- Name the file BAT and save it to the desired folder. Be sure to write “.bat” at the end, for example: “map.bat”. Then, choose “All files” in the “Save as type” box.

- Run the file and your network drive will be mapped automatically.

Save time with BAT files
BAT files are a particular type of file that contains different commands that can be executed without user intervention. Once you create a file with a specific order, you only need to open it to run that command. Although creating BAT files may seem overwhelming and confusing at first, it becomes much easier after you have practiced a little. You can use them to start programs, run specific commands, create messages, mount a virtual drive, copy folders/files, and perform tasks like update, copy, move, and more.
Do you often use BAT files? Which one do you use most frequently? Tell us in the comments p below.