With all the media available on the Internet and the vast collections of digital libraries and images, we all have a problem when we want to rename a bunch of files so that they will be more accessible with a pronounceable name or a name that makes sense. Renaming a bunch of files one by one is not only frustrating but is also a time-consuming task. Considering this fact, Microsoft long ago introduced a batch renaming feature in Windows explorer which helps you rename multiple files at the same time.
Sure you can use third party tools to batch rename files, but often these tools have many features that confuse an average user, and you don’t want to install another software just to rename some files occasionally.
Using Windows Explorer
Using Windows explorer to batch rename files in Windows is most probably the easiest way. To batch rename files, just select all the files you want to rename, press the F2 button (alternatively, right-click and select rename) and then enter the name you want and press the enter button.
What the above action does is take the file name you specified and adds a number to each file name. As you can see from the above and below images, I have renamed the files from “test (*).html” to “file (*).html”.
It is that easy to rename files using Windows explorer, but this method is just basic and is not so flexible, e.g. you cannot change the file extensions (.html) and cannot restrict or change Windows from adding numbers, etc. For more advanced functions, we need to use the command prompt and Windows Powershell.
Using the Command Prompt
Renaming batch files using Windows command prompt is much more flexible, and the good thing about using this method is that you can also change extensions of those files. First off, let us see how to rename batch files without changing the extension.
1.Open the folder that contains the files to be renamed. Here click on File and on “open command prompt.”
2.The above action will open the command prompt in the desired location. Now enter the following command to batch rename the files. Don’t forget to replace “file” with current file name and “name” with your desired name. Because we are using wildcard, there is no need for you to enter full file name(s).
Once you have executed the command, all the files are renamed to the new name and while keeping the extensions intact. If you want to bulk change the extensions (e.g. html to txt), then use the following command.
The above command will rename all the files with .html extension in the directory to .txt extension.
Using Windows Powershell
Windows Powershell is far more powerful than the regular command prompt and is also easy to use. To batch rename files using Powershell, we need to use two commands, i.e. DIR and Rename-Item. Now to batch rename without changing their extensions, press the WIN button, type “powershell” and press enter button to open Powershell.
Once the Windows Powershell is opened, navigate to your desired directory using CD command. As for me, I’m navigating to D:\mte\ as this is where my files are located.
Once you are in the location, use the below command. While using the command, don’t forget to change “TestName” to your desired file name.
What the above command does is that it will take all the files in the directory using the DIR command and pass to the “
Rename-Item” command which renames all the files to “TestName*.” Here * denotes numbers, and those numbers are allocated recursively using “$x.”
Now if you want to change the file extensions of all the files in a directory, use the below command.
What the above command does is take all the files with .html extension in a directory and change them to .txt.
To know more about Rename-Item command, read the Microsoft documentation for more definitions and examples.
Which of the above three method do your prefer?? Sure, Powershell may be overwhelming for beginners but it is fun to work with once you’ve gained some experience.
Hopefully that helps, but do share your thoughts and other methods of manually batch-renaming files.