Have a bunch of files you want to rename but don’t want to go through them one by one? Windows has more options than you may realize.
You can easily rename one or more files using Windows Explorer, but you can do even more with the Command Prompt or PowerShell. Add in third-party renaming utilities, and the possibilities are limitless. Let’s take a look at each option and how it works.
Rename Multiple Files in Windows Explorer
Windows Explorer (known as File Explorer in Windows 10) is an incredibly capable application. You probably already know how to rename a single file, but let’s start with the fundamentals because the advanced methods are built on them.
When using your mouse, you have three options for selecting and renaming a file’s name. You may:
Click to pick the file, then select “Rename” from the Home menu.
Click to choose a file, and then click the file’s name.
Select “Rename” from the context menu after right-clicking the file.
If you want to use your keyboard, you may choose a file with the arrow keys (or start typing the file name) and then select the file name with F2.
You can type a new file name once you’ve picked the file name (note that just the file name is selected, not the extension).
When you’re finished inputting the file name, press Enter (or just click someplace else) to save it.
Here’s where things get interesting: you can also use the Tab key to automatically choose the next file name in the folder, allowing you to start typing a new name right away. If you keep clicking Tab and inputting names in this manner, you can simply rename all the files in a folder.
If you’re changing a group of files in the same folder that don’t need to have totally separate names, Windows gives a simpler option to rename those files in batch. Begin by picking a large number of files—you may use Ctrl to choose many files at once, or Shift to select a range of files. When you’ve got the files chosen, use one of the rename commands—the Home menu button, the context menu command, or just hit F2. All of the files remain chosen, but the first one in the group has its name highlighted, allowing you to create a new name.
Enter a new name for the file, then press Enter or click elsewhere in the window. All of the selected files are renamed with the name you just specified, and a number in parenthesis is attached to differentiate them.
Rename Multiple Files from the Command Prompt
If you want more power, you may use the rename or ren command in a Command Prompt window to rename or ren one or more files. The command recognizes wildcard characters such as * and? for matching several files, which might be useful if you simply want to rename a subset of files in a large folder.
To open a Command Prompt window at your preferred location, open the folder in File Explorer first. Point to “Open command prompt” from the “File” menu, then select “Open command prompt.”
To rename a single file, you can use the following command syntax:
If your file names contain spaces, you must use quotes. You won’t need the quotations if they don’t. To rename a file from “wordfile (1).docx” to “my word file (01).docx,” for example, use the following command:
Because the ren command can address extensions, it may also be used to modify the extensions of several files at the same time. Assume you have a collection of.txt files that you wished to convert to.html files. You may use the following command in conjunction with the * wildcard (which informs Windows that text of any length should be considered a match)
While we’re on the subject of wildcards, did you know that you can do some fascinating things with the? a wildcard that may stand in for any single character Assume you have a number of.html files that you wanted to convert to.htm files instead. To make the modification, use the following command:
This instructs Windows to rename all files with the.html extension to use the same file name and only the first three letters of the file extension, resulting in the “l” being removed from all extensions in the folder.
And this only scratches the surface of the types of command line wizardry you may engage in if you want to weave other commands and conditionals into more complex commands—or even batch scripts. If you’re interested, the Lagmonster forums have a fantastic post on the matter.
Rename Multiple Files with PowerShell
In a command-line context, PowerShell provides even more freedom for renaming files. You may pipe the output of one command (known as a “commandlet” in PowerShell) to another command, exactly like you do on Linux and other UNIX-like systems. Dir, which lists the files in the current directory, and Rename-Item, which renames an item, are the two most significant commands you’ll need (a file, in this case). You’re done if you pipe the output of Dir to Rename-Item.
To open a PowerShell window at your preferred location, open the folder in File Explorer first. Point to “Open Windows PowerShell” from the “File” menu, then select “Open Windows Powershell.”
First, let’s look at renaming a single file. For that, you would use the following syntax:
To rename a file from “wordfile.docx” to “My Word File.docx,” for example, use the following commandlet:
Simple enough. The ability to pipe commandlets together and some of the conditional switches allowed by the rename-item commandlet provide the true power in PowerShell. Assume we have a collection of files labeled “wordfile (1).docx,” “wordfile (2).docx,” and so on.
Assume we wanted to replace the space in those file names with an underscore, resulting in no spaces in the file names. The following commandlet could be used:
The dir commandlet lists all the files in the folder and sends them to the rename-item commandlet (thus the | sign). The $_.name section represents each of the files being piped. The -replace switch specifies that a replacement will take place. The remainder of the commandlet simply indicates that any space (” “) should be replaced with an underscore (” “).
And now our files appear just how we want them to.
As you would think, PowerShell has a lot of options for naming files, and we’re just scratching the surface. For example, the rename-item commandlet includes a -recurse switch that allows the commandlet to be applied to files in a folder as well as all folders nested within that folder, a -force switch that can force renaming for files that are locked or otherwise unavailable, and even a -whatif switch that describes what would happen if the commandlet was executed (without actually executing it). Of course, you may create more complex commandlet structures that contain IF/THEN logic. More about PowerShell in general may be found in our Geek School tutorial, and more on the rename-item commandlet can be found in Microsoft’s TechNet Library.
Rename Multiple Files Using a Third Party App
If you need to rename numerous files at once and aren’t interested in learning the Command Prompt or PowerShell commands, you may always use a third-party program.
There are other renaming programs available, many of which are excellent, but we have two obvious favorites: Bulk Rename Utility and AdvancedRenamer. (Update: Try Microsoft’s free PowerRename tool, which works quite well and has an easy-to-use interface.)
How to Use Bulk Rename Utility
Bulk Rename Utility has a busy and rather daunting interface, but it exposes a plethora of choices that would ordinarily be available only through regular expressions and complex command-line arguments.
Launch the program after installing it, go to the files you wish to rename, and pick them.
When you alter selections in one or more of the many accessible panels, a preview of your changes will display in the “New Name” column where your files are listed. In this example, I’ve altered four panels, which are now highlighted in orange to make it clear what I’ve done. I’ve instructed the tool to rename all files “Word File” and to use title case. I’ve added the file’s creation date in YMD format. I’ve also included an automatic file number at the end of the file name that starts at one, increments by one, and is separated from the file name by an underscore.. And that’s just scratching the surface of what the Bulk Rename Utility can do. When you’re happy with the look of your new file names, simply click the “Rename” button.
And as you can see, the utility handled my simple requests with ease.
How to Use AdvancedRenamer
It encourages you to construct renaming methods using a simple but strong syntax rather than exposing them all as panels in the interface. It’s not difficult to learn, and they provide plenty of help and examples. The program has a much better interface and allows you to create complex batch tasks that combine numerous renaming techniques and apply them to huge numbers of files. You may also store your renaming techniques for subsequent use.
In the following example, I’ve written a renaming method using the syntax:
This instructs AdvancedRenamer to rename all of my files “Word File” and include the creation date in YMD format (separating each portion by an underscore). It also inserts an incremental file number in parenthesis, separated by an underscore.
And, as you can see, my files have been renamed exactly how I want them. AdvancedRenamer has a steeper learning curve than Bulk File Renamer, but you get much finer control over your file names as a result.
Do you know of any additional techniques to rename files in Windows that we haven’t covered? Please leave a comment to let us know about it.