TechSpace Knowledgebase
Search:     Advanced search
Browse by category:
Contact Us

How to Batch Rename Multiple Files in Windows

Views: 866
Votes: 1
Posted: 28 Dec, 2016
by: Theeramanasin V.
Updated: 29 Dec, 2016
by: Theeramanasin V.

wrn_top_v2

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.

wrn_1

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.

wrn_2

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.

wrn_3

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.

wrn_4

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.”

wrn_5

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"

wrn_6

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.”

wrn_7

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"

wrn_8

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.

wrn_9

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 " ","_"}

wrn_10

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 ( "_" ).

And now, our files look the way we want.

wrn_11

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-itemcommandlet 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.

wrn_12

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.

wrn_13

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

wrn_14

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.

wrn_15

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.

wrn_16

Others in this Category
document How to clear your download history
document How to change your screen resolution
document How to ping test in Windows 10
document How to ping test in Windows XP
document How to ping test in Windows 7 and Vista
document How to ping test in Windows 8
document Enable Hyper-V on Windows 8.1
document Enable Built-in Administrator Account in Windows
document Disable Built-in Administrator Account
document Turning Off BitLocker Drive Encryption (Windows 7)
document Uninstalling SP1 using Programs and Features
document Uninstalling SP1 using the Command Prompt
document Installing SP1 using an installation DVD
document Disable Office updates on Windows 8.1 or Windows 7
document Disable Office 2016/2013 updates on Windows 10
document Disable Office 365 updates
document How to fix “The User Profile Service failed the logon. User profile cannot be loaded”
document Connect your computer to a domain on Windows 7
document Getting To Safe Mode From Within Windows 8 or 10
document How to repair Office 2010/2013
document How to printing a Test Page in Windows 7.
document How to disable Windows 8.1 Startup Programs.
document How to remove apps and programs Windows.
document How To Enable Windows Defender On Windows 8/Windows 8.1
document How to export an Outlook 2010 .pst fil
document How to change, add, or remove a drive letter
document Create and format a new partition (volume)
document Reset Windows Activation/Remove license key
document How to restore a Windows 8 laptop or PC to factory default settings
document How to insert a Pivot Table
document How to Change / Set a Password in Windows 10
document Create a local user account in Windows 10
document Change a display language
document Change the keyboard layout or other method you use to type
document Change your display language in Windows 8
document "The command cannot be performed" error message when you double-click to open a document in Word 2007 or in Word 2003
document How to Recover Software Product Keys From Any Computer, Even a Broken One
document How to Customize the Taskbar in Windows 10
document How to Create a Guest Account in Windows 10
document How to Disable Driver Signature Verification on 64-Bit Windows 8 or 10 (So That You Can Install Unsigned Drivers)
document How to Delete a User Account in Windows 7, 8, or 10
document How to Remove Local User Accounts From the Login Screen in Windows
document How to Disable the Lock Workstation Functionality (Window+L) in Windows
document How to Install Windows on a Chromebook
document How to Change the Default Control Panel View in Windows
document How to Change the Default Quiet Hours in Windows 10
document How to Stop Aero Shake from Minimizing Your Windows
document How Secure Boot Works on Windows 8 and 10, and What It Means for Linux
document How to Hide Items from the Control Panel in Windows
document How to Clear Your Internet Explorer Browsing History
document How to Enable the Status Bar and Word Wrap at the Same Time in Notepad
document How to Reset Notepad to Its Default Settings on Windows
document How to Use Sticky Notes on Windows 10
document How to Fix Hard Drive Problems with Chkdsk in Windows 7, 8, and 10
document How to Disable Access to the Windows Registry
document 15 Things You Can Do With Cortana on Windows 10.
document How to create a Windows 10 installer USB drive from a Mac.
document How to Change Folder Icon Color in Windows.
document How to Recover Administrator Password in Windows 10, Windows 8 and Windows 7.
document How to Bypass Windows 10 / 8 / 7 Local Administrator Password.
document Do you know the use of Function Keys (F1 to F12)?
document How To Block Or Unblock USB Drives In Windows
document How to make a full backup of your Windows 10 PC



RSS