Computer >> Computer tutorials >  >> System >> windows

How to Create and Use a Batch File to Move Multiple Files in Windows 10

How to Create and Use a Batch File to Move Multiple Files in Windows 10

Moving and arranging files around on your computer can be time-consuming. In Windows 10, it is faster to create a batch file (.bat) and move multiple source files and subfolders to any destination folder. You can define the properties of such a .bat file in advance and transfer files later at your ease.

A .bat file is a well-known yet little used secret of Windows which can execute different kinds of commands with actionable results.

This is the latest 2020 guide for creating a batch file in Windows 10 from scratch. We will also show how to utilize such a .bat file to move files from any source to a destination folder.

Create a Batch File from Scratch

You can create a .bat file in any Windows 10 folder of your choice. To create it from scratch, simply go to the destination folder of your choice, right-click and create a new .txt file.

How to Create and Use a Batch File to Move Multiple Files in Windows 10

Once the Notepad file is created, rename the extension from .txt to .bat.

How to Create and Use a Batch File to Move Multiple Files in Windows 10

Ignore the “file will become unusable” message due to change in file name extension and click Yes. An empty batch file has now been created with no contents.

How to Create and Use a Batch File to Move Multiple Files in Windows 10

The .bat file is prominently visible in the folder. It can be deleted, copy-pasted, renamed, and transferred to any other folder.

How to Create and Use a Batch File to Move Multiple Files in Windows 10

Use Batch File to Create Folders and Subfolders

You can use a .bat file to create separate folders and subfolders whose contents and properties remain connected to the .bat file. No matter which PC location you move the .bat file to, the folders and subfolders will follow. Any contents saved in these folders can simply be moved by relocating the Master .bat file.

Right-click the created .bat file to “Edit using Notepad” and enter the following to create folders using folder names.

@echo off
 
md FolderName1 FolderName2..."Folder Name3"

The purpose of @echo off is to disable the display prompt. This way you won’t have to deal with the Command prompt, although it’s internally connected to .bat file processes. If your folder name should contain a space, put it inside quotes. Save the file and exit Notepad.

How to Create and Use a Batch File to Move Multiple Files in Windows 10

As soon as you click the .bat file, it will execute the command to create the new folders.

How to Create and Use a Batch File to Move Multiple Files in Windows 10

To create subfolders in any folder, modify the above code as shown here. Save the file and exit Notepad.

md FolderName/SubFolder1 FolderName/SubFolder 2...
How to Create and Use a Batch File to Move Multiple Files in Windows 10

As shown here, the subfolders have been created.

How to Create and Use a Batch File to Move Multiple Files in Windows 10

Move Files from One Folder to Another Using Batch Files

You can use .bat files to move files from any folder on your Windows 10 to a destination folder of your choice. All you need is a proper folder path to complete the transfers. The best way to know a folder’s path is to right-click and select “Properties” followed by “Location.”

How to Create and Use a Batch File to Move Multiple Files in Windows 10

As shown here, we will move all the contents of “FolderA” to “FolderB.” The command is as follows:

move Source-Folder-Path*.* Destination-Folder-Path

Here, *.* is a wildcard that tells Windows 10 to copy all the files in the source folder. If any part of the folder path has a folder name with spaces, you need to enclose it within quotes.

How to Create and Use a Batch File to Move Multiple Files in Windows 10

Save the file and exit Notepad.

The entire contents of one folder have been moved to another by clicking .bat file.

How to Create and Use a Batch File to Move Multiple Files in Windows 10

If you want to move only select files, the code can be slightly modified as shown below.

move Source-Folder-PathFile Name1, File Name2*.* Destination-Folder-Path
How to Create and Use a Batch File to Move Multiple Files in Windows 10

If you wish to move only specific file types between the folders, for example, JPG files, modify the code as shown below.

move Source-Folder-Path*.file_type Destination-Folder-Path

For example, to move all .jpg files, use the code below:

move Source-Folder-Path*.jpg Destination-Folder-Path
How to Create and Use a Batch File to Move Multiple Files in Windows 10

As per the code, only JPG files have moved in this example.

How to Create and Use a Batch File to Move Multiple Files in Windows 10

You can replace the .jpg with .pdf, .png, or any other file type you want to move.

In this guide you have learned how to create a batch file from scratch and move files and folders around your computer. Every time you click on a .bat file, it will move the contents at the target location. It’s so simple!

Do you also know that you can batch edit images and batch rename files in Windows? Click the links to find out how.