Home > Think Tank > How to Batch Rename Files in Windows: 3 Ways to Rename Multiple Files?
January 27, 2014

How to Batch Rename Files in Windows: 3 Ways to Rename Multiple Files?

Windows comes with a variety of ways to rename multiples files at once from Windows Explorer, the Command Prompt, or PowerShell. Whether you’re looking for an easy-to-use graphical interface or a powerful command-line method, you’ll find it here.

The Windows Explorer method is fast, but lacking in flexibility. PowerShell is extremely flexible – but it can be intimidating if you’re new to PowerShell.



Windows Explorer

Windows Explorer has a quick, built-in way to rename multiple files at once, although it’s pretty well hidden.

To get started, locate the files you want to rename and place them in the same folder. Use the columns at the top of the list in details view to order the files how you’d like them – Windows Explorer will number the files starting from the top at the list.

Select all the files you want to rename, right-click the first one and select Rename. Type your desired base file name and press Enter.
Windows Explorer will take your base name and add a number to each file’s name. This method is good for cleaning up messy names, although it isn’t very flexible.



Command Prompt

You can use the rename – or ren – DOS command in a Command Prompt window to rename multiple files at once. It accepts the wildcard character – * – to match multiple files. The quickest way to open a Command Prompt window at your desired location is to hold Shift, right-click in the folder, and select “Open command window here.”

The most obvious use case for the rename command is changing multiple file extensions at once – something you can’t do in Windows Explorer. The following command will rename all .html files in the current folder to .txt files:
ren *.html *.txt

This command doesn’t offer a lot of power on its own, although it can be integrated into more complex batch scripts.



PowerShell

PowerShell offers much 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.
After you launch PowerShell, use the cd command to enter the directory containing your files. You should put the files in their own directory so you don’t accidentally rename other files.

For example, let’s say we don’t want the space character in our file names – we’d rather have an underscore instead.

The following command lists the files in the current directory and pipes the list to Rename-Item. Rename-Item replaces each space character with an underscore.

Dir | Rename-Item –NewName { $_.name –replace “ “,”_” }
Replace the “ “ and “_” parts of the command to replace other characters in file names.
4 0
comments powered by Disqus

WHY CHOOSE WISECLEANER?

60-Day Money Back Guarantee

Try before you buy with a free trial – and even after your purchase, you're still covered by our 60-day, no-risk guarantee.

Secure Online Payment

We value your privacy and protect your financial and personal data with full encryption and advanced fraud protection.

7 X 24 SUPPORT SERVICE

Knowledgeable representatives available to assist you through email response within 24 hours.