Moving and organizing files on your computer can take time. In Windows 10, it’s faster to create a batch file (.bat) and move multiple source files and subfolders to any destination folder. You can set the properties of such a .bat file in advance and transfer files later at your ease.
A .bat file is a well known but little used secret of Windows which can execute different types of commands with exploitable results.
This is the latest 2020 guide to creating a batch file in Windows 10 from scratch. We will also show how to use 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.
Once the Notepad file is created, rename the extension from .txt to .bat.
Ignore the message “the file will become unusable” due to a change in file name extension and click Yes. An empty batch file has now been created with no content.
The .bat file is clearly visible in the folder. It can be deleted, copied and pasted, renamed and transferred to any other folder.
Use a 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. Regardless of the location of the PC to which you move the .bat file, the folders and subfolders will follow. Any content saved in these folders can be simply moved by moving the Master .bat file.
Right-click the .bat file created in “Edit using Notepad” and enter the following information to create folders using folder names.
The goal of
@echo off is to disable the display prompt. This way, you will not have to manage the command prompt, although it is internally connected to .bat file processes. If the name of your folder must contain a space, enclose it in quotes. Save the file and exit Notepad.
As soon as you click on the .bat file, it executes the command to create the new folders.
To create subfolders in any folder, modify the code above as shown here. Save the file and exit Notepad.
As noted here, the subfolders have been created.
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 an appropriate folder path to complete the transfers. The best way to find out the path to a folder is to right-click and select “Properties” then “Location”.
As indicated here, we will move all the content from “FolderA” to “FolderB”. The command is as follows:
*.* is a wildcard that tells Windows 10 to copy all the files in the source folder. If part of the folder path has a folder name with spaces, you must enclose it in quotes.
Save the file and exit Notepad.
The entire contents of one folder have been moved to another by clicking on the .bat file.
If you want to move only selected files, the code can be changed slightly as shown below.
If you want to move only specific file types between folders, such as JPG files, change the code as shown below.
For example, to move all .jpg files, use the code below:
According to the code, only JPG files have been moved in this example.
You can replace the .jpg with .pdf, .png or any other type of file that you want to move.
In this guide, you have learned how to create a batch file from scratch and how to move files and folders on your computer. Each time you click on a .bat file, it moves the content to the target location. It’s so simple!
Did you also know that you can batch edit images and batch rename files in Windows? Click on the links to find out how
Is this article useful?