RSS

How-To Geek

Got a bunch of files you want to rename, but don’t want to go through them each one by one? Windows provides more ways to do this than you may realize.

You can easily rename one or more files just with Windows Explorer, but you can do even more with the Command Prompt or PowerShell. Add in third-party renaming utilities, and the possibilities are endless. 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 surprisingly powerful. You probably know how to rename a single file, but let’s start with the basics, since the advanced tricks build off them.

If you’re using your mouse, you have no less than three ways to select a file’s name and rename it. You can:

Click to select the file and then click the “Rename” button on the Home menu.

Click to select file and then click the name of the selected file.

Right-click the file and then select “Rename” on the context menu.

And if you prefer sticking with your keyboard, you can just use your arrow keys (or start typing the file name) to select a file and then hit F2 to select the file name.

Once you’ve got the file name selected—and you’ll notice only the file name itself is selected, not the extension—you can type a new file name.

When you’re done typing the file name, you can press Enter (or just click somewhere else) to save the new name.

Here’s where things get interesting: you can also hit the Tab key to automatically select the next file name in the folder so that you can immediately begin typing a new name for it. Keep hitting Tab and typing names this way and you can easily rename all the files in a folder if you’re so inclined.

If you’re renaming a bunch of files in the same folder and those files don’t need completely different names from one another, Windows provides an easier way to rename those files in batch. Start by selecting a bunch of files—you can hold down the Ctrl key to select multiple files at once, or Shift to select a range of files. When you’ve got the files selected, use one of the rename commands—the button on the Home menu, the command on the context menu, or just press F2. You’ll see that all the files remain selected, but the first one in the group gets its name highlighted so you can type a new name.

Type a new name for the file and then hit Enter or click somewhere else in the window. All the selected files are renamed using the name you just typed, and are appended with a number in parentheses to differentiate them.

Rename Multiple Files from the Command Prompt

If you need more power than that, you can use the rename or ren command in a Command Prompt window to one or more files. The command accepts wildcard characters like * and ? for matching multiple files, which can be helpful if you only want to rename a certain selection of files in a folder full of many.

The quickest way to open a Command Prompt window at your desired location is to first open the folder in File Explorer. From the “File” menu, point to “Open command prompt,” and then select “Open command prompt.”

To rename a single file, you can use the following command syntax:

ren "current_filename.ext" "new_filename.ext"

The quotes are important if your file names contain any spaces. If they don’t, you won’t need the quotes. So, for example, to rename a file from “wordfile (1).docx” to “my word file (01).docx” you would use the following command:

ren "wordfile (1).docx" "my word file (01).docx"

Since the ren command can address extensions, you can also use it to change the extensions of multiple files at once. Say, for example, you had a selection of .txt files that you wanted to turn into .html files. You could use the following command along with the * wildcard (which basically tells Windows that text of any length should be considered a match):

ren *.txt *.html

And while we’re on the subject of wildcards, you can also do some interesting things with the ? wildcard, which is used to stand in for any single character. Say, for example, you had a bunch of .html files that you wanted to turn into .htm files instead. You could use the following command to make the change:

ren *.html *.???

This tells Windows to rename all files with the .html extension to use the same file name and same first three letters only of the file extension, which ends up cutting the “l” off of all the extensions in the folder.

And this only begins to address the kinds of command line wizardy you can get into if you want to build more complicated commands—or even batch scripts—by weaving other commands and conditionals into things. If you’re interested, the folks over at the Lagmonster forums have an excellent writeup on the subject.

Rename Multiple Files with PowerShell

PowerShell offers even more flexibility for renaming files in a command-line environment. Using PowerShell, you can pipe the output of one command—known as a “commandlet” in PowerShell terms—to another command, just like you can on Linux and other UNIX-like systems. The two important commands you’ll need are Dir, which lists the files in the current directory, and Rename-Item, which renames an item (a file, in this case). Pipe the output of Dir to Rename-Item and you’re in business.

The quickest way to open a PowerShell window at your desired location is to first open the folder in File Explorer. From the “File” menu, point to “Open Windows PowerShell,” and then select “Open Windows Powershell.”

First, let’s look at renaming a single file. For that, you would use the following syntax:

rename-item "current_filename.ext" "new_filename.ext"

So, for example, to rename a file from “wordfile.docx” to “My Word File.docx” you would use the following commandlet:

rename-item "wordfile.docx" "My Word File.docx"

Easy enough. But the real power in PowerShell comes from the ability to pipe commandlets together and some of the conditional switches supported by the rename-item commandlet. Say, for example, we had a bunch of files named “wordfile (1).docx”, “wordfile (2).docx”, and so on.

Say we wanted to replace the space in those file names with an underscore so that the file names contain no spaces. We could use the following commandlet:

dir | rename-item -NewName {$_.name -replace " ","_"}

The dir part of that commandlet lists all the files in the folder and pipes them (that’s the | symbol) to the rename-item commandlet. The $_.name part stands in for each of the files getting piped. The -replace switch indicates that a replacement is going to happen. The rest of the commandlet just signifies that any space ( " " ) should be replaced by an underscore ( "_" ).

As you might expect, PowerShell offers tremendous power when it comes to naming your files and we’re only scratching the surface here. For example, the rename-item commandlet also offers features like a -recurse switch that can apply the commandlet to files in a folder and all folders nested inside 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). And, of course, you can also build more complicated commandlet structures that even include IF/THEN logic. You can learn more about PowerShell in general from our Geek School guide, and learn more about the rename-item commandlet from Microsoft’s TechNet Library.

Rename Multiple Files Using a Third Party App

If you need a powerful way to rename multiple files at once and you’re just not up for mastering the Command Prompt or PowerShell commands, you can always turn to a third-party utility. There are countless renaming apps our there—and many of them are good—but we have two clear favorites: Bulk Rename Utility and AdvancedRenamer.

How to Use Bulk Rename Utility

Bulk Rename Utility has a cluttered and somewhat intimidating interface, but it exposes the huge number of options you’d normally only get with regular expressions and complicated command-line options.

After installing the tool, launch it, navigate to the files you want to rename, and select them.

Change options in one or more of the many available panels, and you’ll see a preview of your changes appear in the “New Name” column where your files are listed. In this example, I’ve made changes to four panels, which are now highlighted in orange so it’s easier to tell what I’ve changed. I’ve told the utility to change the name of all files to “Word File” and to use title case. I’ve appended the date the file was created in the YMD format. And I’ve also added an automatic file number that appears at the end of the file name, starts at one, increments by one, and is separated from the file name by an underscore. And that’s only a tiny bit of what you can do with the Bulk Rename Utility. When you’re satisfied with how your new file names will look, all you have to do is click the “Rename” button.

And as you can see, the utility handled my simple requests with ease.

How to Use AdvancedRenamer

Our other favorite renaming tool, AdvancedRenamer, also exposes a huge number of renaming methods, but instead of presenting them all as panels in the interface, it asks that you use a pretty simple but powerful syntax to create renaming methods. It’s not hard to learn and they have good support, along with examples. The tool does sport a much friendlier interface and supports setting up advanced batch jobs so you can combine multiple renaming methods and apply them to large numbers of files. You can also save renaming methods you create for later use.

In the example below, I’ve created a renaming method using the following syntax:

Word File_<Year>_<Month>_<Day>_(<Inc Nr:1>)

This tells AdvancedRenamer to name all my files “Word File” and to add the creation date in the YMD format (separating each portion by an underscore). It also adds an incremental file number in parentheses and separated by an additional underscore.

And as you can see, my files have been renamed just the way I want. AdvancedRenamer has a bit steeper learning curve than Bulk File Renamer, but the reward for that is that you get much finer control over your file names.

Have other ways to rename files in Windows we haven’t covered? Be sure to leave us a comment and let us know about it.

Great article. However it doesn't make it clear if you can use this with graphics (image files) or not - although i suppose the clever ones amongst can.However for the less well informed who wish to change e.g. jpeg files to giff files it is simple in Paint Shop Pro (PSP - any version) or Corel X?. There is a 'batch file' transform in all these progs that quite simply lists your original file type on the left and you select the file type you need and press go. Quick easy change from one format to another. Great when you are working with website building or graphic designs etc.

This article only explains how to change the names of files, something I knew how to do easily under DOS. Thanks for showing me how to do this under Win10 @ChrisHoffman . Renaming files does not change or convert the file, it just renames it @bionicle. If only it were so easy!

Great article. However it doesn't make it clear if you can use this with graphics (image files) or not - although i suppose the clever ones amongst can.However for the less well informed who wish to change e.g. jpeg files to giff files it is simple in Paint Shop Pro (PSP - any version) or Corel X?. There is a 'batch file' transform in all these progs that quite simply lists your original file type on the left and you select the file type you need and press go. Quick easy change from one format to another. Great when you are working with website building or graphic designs etc.

This article only explains how to change the names of files, something I knew how to do easily under DOS. Thanks for showing me how to do this under Win10 @ChrisHoffman . Renaming files does not change or convert the file, it just renames it @bionicle. If only it were so easy!

DID YOU KNOW?

The majority of cheetahs were wiped out during the last ice age; the remaining cheetah population is inbred such that all remaining cheetahs are virtually clones of each other.