How to create a BAT file

Jugo Mobile
By
Jugo Mobile
Jugo Mobile is a platform dedicated to high-quality content in gaming, sports, and tech. Engage with high-quality content and connect with fellow enthusiasts and experts. Explore...
8 Min Read

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:

  1. Open the Start menu, start typing “Notepad” and open it.
    How to create a BAT file
  2. 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
    “.
    1709814274 961 How to create a BAT file
  3. Select File.”
    1709814274 30 How to create a BAT file
  4. Choose “Save As.”
    1709814274 428 How to create a BAT file
  5. 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.
    1709814274 112 How to create a BAT file
  6. 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!”
    1709814274 600 How to create a BAT file

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:

  1. Find the folder you want to move files from and right-click on it.
    1709814274 742 How to create a BAT file
  2. Select “Properties.”
    1709814274 412 How to create a BAT file
  3. Copy the text to the right of “Location.” For example, “C:\Users\User”.
    1709814274 139 How to create a BAT file
  4. Open the Notepad app and paste the text.
    1709814274 252 How to create a BAT file
  5. Locate the destination folder and right click on it.
    1709814274 820 How to create a BAT file
  6. Choose “Properties.”
    1709814274 517 How to create a BAT file
  7. Copy the text next to “Location.” For example, “C:\Users\User\Desktop”.
    1709814274 300 How to create a BAT file
  8. Paste the text below the source folder location.
    1709814274 768 How to create a BAT file

Now that you have the folder paths, it’s time to create the file:

  1. 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.
    1709814274 174 How to create a BAT file
  2. Press “File.”
    1709814274 575 How to create a BAT file
  3. Select “Save As.”
    1709814274 16 How to create a BAT file
  4. 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.
    1709814274 362 How to create a BAT file
  5. Open the BAT file and the files in the source folder will be automatically moved to the destination folder.
    1709814274 969 How to create a BAT file

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:

  1. Open Notepad.
    1709814274 695 How to create a BAT file
  2. Write the following text:
    @ECHO OFF
    DEL [file destination and name]
    “.
    1709814274 3 How to create a BAT file
  3. Select File.”
    1709814274 236 How to create a BAT file
  4. Choose “Save As.”
    1709814274 21 How to create a BAT file
  5. 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.
    1709814275 442 How to create a BAT file
  6. Run the BAT file and the file whose destination and name you entered will be deleted automatically.
    1709814275 405 How to create a BAT file

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:

  1. Find the file you want to copy and right-click on it.
    1709814275 880 How to create a BAT file
  2. Choose “Properties” and copy the file location.
    1709814275 969 How to create a BAT file
  3. Repeat the steps to save the destination folder location.
  4. Open Notepad.
    1709814274 695 How to create a BAT file
  5. Write the following lines:
    ECHO OFF
    copy [source] [destination]
    “.
    1709814275 345 How to create a BAT file
  6. Choose the file.”
    1709814275 452 How to create a BAT file
  7. Select “Save As.”
    1709814275 622 How to create a BAT file
  8. 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.
    1709814275 640 How to create a BAT file
  9. Open the file and the file whose location you entered will be copied to the desired destination.
    1709814275 503 How to create a BAT file

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:

  1. Open the Start menu, start typing “Notepad” and open it.
    1709814274 695 How to create a BAT file
  2. Write the following lines:
    ECHO Create new [drive letter] drive mapping
    @net use [drive letter]:\Network path/persistent: yes
    :exit
    @pause
    “.
    1709814275 305 How to create a BAT file
  3. Choose the file.”
    1709814275 759 How to create a BAT file
  4. Press “Save As.”
    1709814275 292 How to create a BAT file
  5. 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.
    1709814275 298 How to create a BAT file
  6. Run the file and your network drive will be mapped automatically.
    1709814275 5 How to create a BAT file

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.

TAGGED:
Share This Article
Follow:
Jugo Mobile is a platform dedicated to high-quality content in gaming, sports, and tech. Engage with high-quality content and connect with fellow enthusiasts and experts. Explore the latest trends and innovations in our vibrant community. Join us and experience the future today!
Leave a Comment
Grow your brand and reach a larger audience. Advertise with us today and get noticed by thousands.
© 2025 Jugo Mobile. All Rights Reserved.