How to batch rename multiple files in Windows?

Sometimes you get a lot of files with random names. For example, you downloaded photos from Tumblr to a desktop computer. Or you have exported an animation frame by frame in a png sequence. It may be hundreds or even thousands of files. To save time you should use special tools. There are a lot of ways to perform renaming: Windows Explorer built-in functions, PowerShell scripts and third-party applications.

Windows Explorer. How to rename multiple files?

Windows Explorer is a built-in file manager in Windows operation system. In Windows 10 it is called File Explorer. To open it press Windows + E keys. Go to the folder with files you want to rename.

File Explorer in Windows 10

First, you need to select files. You have options:

  • Left click on file to select one;
  • hold down Ctrl and continue clicking to select more than one file;
  • click on the selected file while holding down Ctrl to deselect it;
  • hold down Shift and click on two files to select all files between them;
  • click, hold and move the mouse to select multiple files;
  • press arrow keys to select the next or previous file;
  • select first file, hold down Shift and move to the next file with arrows keys to select multiple files;
  • start typing name of the file to select it;
  • press Ctrl + A to select all files;

Combine them to quickly select files.

File Explorer with selected files

Go to the Home tab and click on the Rename button. Last selected file in the sequence will be highlighted.

Rename files in File Explorer

Type new file name and press Enter. I typed in tumblr_photo_. Pay attention to the counter that was automatically added to each file name. The number of the file is surrounded with parentheses. Space symbol is also added before each counter.

File Explorer with renamed files

If you made a mistake while renaming files you can undo this action. Press Ctrl + Z and old names will be recovered.

You may also use a context menu. Make a selection and do the right click on one of selected items. Click on Rename. Type new file name. Press Enter. Done.

Context menu of File Explorer

The quickest way is to use shortcuts. Select one or few files and press F2. Rename mode will be enabled immediately. To apply new names press Enter. If you selected one file you can press Tab to confirm changes and go to the next file.

File Explorer is the simplest way to rename files, but it has few limitations:

  • The counter is placed at the end of the file name and is surrounded with parentheses. Space symbol is also added to it. You can't change this template;
  • the counter is formed without leading zeros. You can't get a sequence like this: file-01.txt, file-02.txt, file-03.txt etc;
  • you can't change the file extension.

PowerShell. How to use rename multiple files script?

PowerShell is a built-in command line tool for task automation in Windows 7 and later versions. It allows to rename files in a more flexible way, but it is much complicated in use.

First, go to a folder with files to be renamed. Click on tab File, Open Windows PowerShell, and Open Windows PowerShell as administrator.

How to open PowerShell at current directory with File Explorer

Let's do the same rename operation like we did using File Explorer. Copy the script and paste it in PowerShell window with right mouse click:

$i=1; Get-ChildItem *.* | %{Rename-Item $_ -NewName ('tumblr_photo_{0}{1}' -f $i++, $_.extension)}

Press Enter to execute.

How to open PowerShell at a current directory with File Explorer

As you can see there are no parentheses around counter anymore and space symbol disappeared.

Files renamed with PowerShell

To use the script you need to change marked part to set your file name.

$i=1; Get-ChildItem *.* | %{Rename-Item $_ -NewName ('your_file_name_here_{0}{1}' -f $i++, $_.extension)}

You can set where counter will appear. Just move marked part within apostrophes. They determine the begin and the end of the name.

$i=1; Get-ChildItem *.* | %{Rename-Item $_ -NewName ('tumblr_photo_{0}{1}' -f $i++, $_.extension)}

For example, you can place counter at the beginning of the name like this:

$i=1; Get-ChildItem *.* | %{Rename-Item $_ -NewName ('{0}_tumblr_photo{1}' -f $i++, $_.extension)}

The result will look like this.

Change counter position

Note that you already got rid of few limitations of File Explorer rename function. Now you can set a template by yourself and place the counter in any place of the name.

PowerShell. How does rename script work?

If you don't want to spend your time on understanding what all those special words and symbols mean just skip this part. If you are familiar with programming it will be much easier to understand.

Let's disassemble the script and see what each part does.

$i=1; Get-ChildItem *.* | %{Rename-Item $_ -NewName ('tumblr_photo_{0}{1}' -f $i++, $_.extension)}

$i=1 — declare a new variable with the name i and initiate it with value 1. It will be used to generate a counter number at the end of each name. You can set this variable to any number and the whole sequence will begin with it.

$i=1; Get-ChildItem *.* | %{Rename-Item $_ -NewName ('tumblr_photo_{0}{1}' -f $i++, $_.extension)}

; — used to separate commands in PowerShell. This is similar to a programming language because it actually is.

$i=1; Get-ChildItem *.* | %{Rename-Item $_ -NewName ('tumblr_photo_{0}{1}' -f $i++, $_.extension)}

  • Get-ChildItem *.* | — call Get-ChildItem command which returns list of files in current folder;
  • *.* — allow to enable filter by name and extension. That will be used a bit later;
  • | — mean that each result (each file name) will be send to the next command. Which is Rename-Item.

$i=1; Get-ChildItem *.* | %{Rename-Item $_ -NewName ('tumblr_photo_{0}{1}' -f $i++, $_.extension)}

  • %{Rename-Item $_ -NewName — apply a new name to each file according to the template;
  • $_ — a variable that was sent to rename command (in our case each file name);
  • 'tumblr_photo_{0}{1}' — a template for new file name;
  • tumblr_photo_ — text that will be placed in each file name;
  • {0} — that part will be replaced with the first variable which is $i (counter);
  • {1} — that part will be replaced with the second variable which is $_.extension (file extension);
  • -f $i++, $_.extension — list of variables (first and second one) that will be used in the template;
  • $i++ — return a unique number for the counter. The first variable which will be used in the template as a counter. Please note a post-increment operator ++ that will increase the variable value by one after sending it to the template. That small part allows to have a unique number in each name;
  • $_.extension — return the file extension. The second variable which will be used in the template as the file extension.

PowerShell. Add leading zeroes to the counter

If you want to add leading zeroes to the counter, use this script. Note marked part. D means digital and 3 means the number of zeroes. Change this number to get more leading zeroes if needed.

$i=1; Get-ChildItem *.* | %{Rename-Item $_ -NewName ('tumblr_photo_{0:D3}{1}' -f $i++, $_.extension)}

The result will look like this.

3 leading zeroes

PowerShell. Filter input files

You can filter files that will be processed by extension. Edit marked part to change the extension.

$i=1; Get-ChildItem *.jpg | %{Rename-Item $_ -NewName ('tumblr_photo_{0:D2}{1}' -f $i++, $_.extension)}

I have added few png files to the test folder. As you can see only jpg files were renamed. Png files are untouched.

Filter by extension

Now I have added few files that include test word in the name. You can filter files by keyword using this script. Edit marked part with your keyword.

$i=1; Get-ChildItem *.* -Filter "*test*" | %{Rename-Item $_ -NewName ('tumblr_test_photo_{0:D2}{1}' -f $i++, $_.extension)}

The folder content before script execution.

Filter by keyword

The folder content after script execution. Only files with test keyword were processed.

Filter by keyword after

You can combine both scripts to filter by keyword and extension at the same time.

PowerShell. Change only a file extension

You can change file name and extension using next script. Set new name and extension by changing marked part.

$i=1; Get-ChildItem *.* | %{Rename-Item $_ -NewName ('tumblr_photo_{0:D2}.png' -f $i++)}

If you need to change only an extension use this script. Set your extension by changing the marked part.

Get-ChildItem *.* | Rename-Item -NewName { [System.IO.Path]::ChangeExtension($_.Name, ".jpg") }

If you want to apply a filter by name or extension, combine those scripts with previous ones. As you can see PowerShell is a pretty flexible tool.

PowerShell. Convert all letters to lowercase

Let's see one more common example. You can convert all letters to lower case using this script.

Get-ChildItem *.* | Rename-Item -NewName { $_.Name.ToLower() }

There are a lot more things you can do. Despite PowerShell eliminates all limitations of the File Explorer, it has few weighty disadvantages.

  • You can't recover renamed files. The procedure is irreversible. But that is possible in File Explorer;
  • it is pretty complicated for beginners. You can make a mistake easily;
  • it takes much more time to open PowerShell and form correct script.

PowerShell is often used by system administrators, programmers, and other professionals. Don't take on too much, you may try something simpler.

PowerShell in action

The demonstration below shows how to:

  • Rename files with a png extension and add leading zeroes to the counter;
  • rename files with a jpg extension and add leading zeroes to the counter;
  • rename all files and add leading zeroes to the counter;
  • rename all files and change the extension.

PowerShell in action

Third-party software

There are a lot of special applications that allow renaming multiple files. Some are paid and some are free. They are more flexible than File Explorer and simpler to use than PowerShell. They provide the best ratio of capabilities and speed.

Total Commander

Total Commander is a shareware file manager. Despite it costs 54 dollars you can use it for free (just pass a simple test after each run). It comes with a bundle of useful instruments including FTP-client, file compare, and file rename tools.

Total Commander

First, you need to select files you want to rename. There are few options.

  • Press Insert to select one file. Hold Insert to continue selecting files one by one;
  • use arrows keys to move the cursor. Press Home to go to the first file. Press End to go to the last file. Hold down Shift to select files while moving cursor;
  • hold down the right mouse button and move mouse cursor through file list;
  • press Ctrl + A to select all files.

Once files are selected press Ctrl + M to run Multi-Rename Tool.

Total Commander

Look at the left upper panel Rename mask: file name. Input field allows setting new file name template. Symbols in square brackets are special parameters that will be replaced. For example, by default rename template looks like this.


[N] (Name) — will be replaced with an old processed name. The old name may be changed with the Search & Replace panel.

Let's do the same rename operation as before. Type in this template.


Column New name will be updated while you typing. The preview function shows all new file names before you start the procedure. Click on Start! button to rename files. The list will become empty. Press Undo to recover old names. Click on Close button to go back to Total Commander.

A multi-rename tool in action

Let's check some other special parameters.

  • [C] (counter) — insert counter, which can be tweaked with parameters in right panel Define counter [C]. You can set start number, step and number of digits (leading zeroes). You can set amount of digits manually like this [C:3]. Where 3 is the number of digits;
  • [Y] [M] [D] (year, month, day) — insert file creation year, month or day. For example, [Y]-[M]-[D]. You may also use [d] to insert date in format month-day-year;
  • [h] [m] [s] (hour, minute, second) $mdash; insert file creation hour, minute or second. For example, [h]_[m]_[s].
  • [N#-#] (range) — insert only part of the old name. Replace the first # with an integer number, which will control a start position of the new name. Second # controls end position of the new name.
  • [=?] (plugin) — click on the corresponding button to select special parameters of the file. It may be size, write or access date and time or even random number;

Combine all those special parameters to generate file name you need. Next panel is Extension. It has much fewer parameters that are similar to Rename mask panel.

Search & Replace panel allows replacing some part of the name with another string. Make sure you have placed [N] parameter in the template. Flags allow to enable case-sensitive search, replace only once, search in the extension and other options. Also, you can convert all letters to lower, upper case and even first letter uppercase and the first letter of each word uppercase.

Define counter [C] panel controls how counter will be placed.

Total Commander. A full list of special parameters

But that is just the beginning. Here is a full list of all special parameters you can use inside template with some examples.

  • [N] — old file name, without extension;
  • [N1] — the first character of the original name;
  • [N2-5] — characters 2 to 5 from the old name (totals to 4 characters). Double-byte characters (e.g. Chinese, Japanese) are counted as 1 character. The first letter is accessed with '1';
  • [N2,5] — 5 characters starting at character 2;
  • [N2-] — all characters starting at character 2;
  • [N02-9] — characters 2-9, fill from left with zeroes if name shorter than requested (8 in this example): "abc" -> "000000bc";
  • [N 2-9] — characters 2-9, fill from left with spaces if name shorter than requested (8 in this example): "abc" -> " bc";
  • [N-8,5] — 5 characters starting at the 8-last character (counted from the end of the name);
  • [N-8-5] — ;
  • — characters from the 8th-last to the 5th-last character;
  • [N2--5] — characters from the 2nd to the 5th-last character;
  • [N-5-] — characters from the 5th-last character to the end of the name;
  • [A] — old file name, WITH extension (All characters of the name), without the path;
  • [2-5] — characters 2-5 from the name including path and extension (other numbers as in [N] definition);
  • [P] — paste the name of the parent directory, e.g. when renaming c:\directory\file.txt -> pastes "directory". Also working: [P2-5], [P2,5], [P-8,5], [P-8-5] and [P2-], see description of [N] above;
  • [G] — grandparent directory (usage: see [P]);
  • [E] — extension;
  • [E1-2] — characters 1-2 from the extension (same ranges as in [N] definition);
  • [C] — paste counter, as defined in Define counter field;
  • [C10+5:3] — paste counter, define counter settings directly. In this example, start at 10, step by 5, use 3 digits width. Partial definitions like [C10] or [C+5] or [C:3] are also accepted. Hint: The fields in Define counter will be ignored if you specify options directly in the [C] field;
  • [C+1/100] — fractional number: Paste counter, but increase it only every n files (in this example: every 100 files). Can be used to move a specific number of files to a subdirectory, e.g. [C+1/100]\[N];
  • [Caa+1] — paste counter, define counter settings directly. In this example, start at aa, step 1 letter, use 2 digits (defined by 'aa' width);
  • [C:a] — ;
  • — paste counter, determine digits width automatically, depending on the number of files. Combinations like [C10+10:a] are also allowed;
  • [d] — paste date as defined in current country settings. / is replaced by a dash;
  • [Y] — paste a year in 4 digit form;
  • [y] — paste a year in 2 digit form;
  • [M] — paste a month, always 2 digits;
  • [D] — paste a day, always 2 digits;
  • [t] — paste a time, as defined in current country settings. : is replaced by a dot;
  • [h] — paste hours, always in 24 hours 2 digit format;
  • [m] — paste minutes, always in 2 digit format;
  • [s] — paste seconds, always in 2 digit format;
  • [u] — convert all composite characters (e.g. separate a and ^) to precomposed characters (â). Must be the first placeholder in the command.;
  • [U] — all characters after this position in uppercase;
  • [L] — all characters after this position in lowercase;
  • [F] — the first letter of each word uppercase after this position, all others lowercase;
  • [n] — all characters after this position again as in original name (upper/lowercase unchanged);
  • [[] — insert square bracket: open;
  • []] — insert square bracket: close (cannot be combined with other commands inside the square bracket!);
  • [=pluginname.fieldname.unit] — insert field named "fieldname" from content plugin named "pluginname". "unit" may be an optional unit (if supported by that field), or a field formatter like YMD for date fields;
  • [=pluginname.fieldname.unit:4-7] — same as above, but for partial strings (here: letters 4-7). Supports the same ranges as the [N] field (see above), including leading spaces or zeroes.

Total Commander comes with powerful rename tool. It also supports regular expressions. Not so flexible as PowerShell, but it is easier to use and you still have undo feature.

Bulk Rename Utility

Bulk Rename Utility is a free multiple file rename tool. It is similar to Multi-rename tool in Total Commander but is simpler to use. The main window includes file explorer at the top. First, you need to find a folder with your files and select them like in Windows File Explorer. You can press Ctrl + A to select all files or use left mouse click while holding Ctrl or Shift.

Then you need to set rename parameters. They are pretty similar to what we saw in Total Commander, but with little differences. For example, the counter is called Numbering here.

If at least one rename parameter will be activated you will see a preview of new names colored with green. Click on Rename button or press Ctrl + R when you are ready. Confirm your action. Press Ctrl + Z to undo.

Bulk Rename Utility in action

Bulk Rename Utility supports:

  • Regular expressions;
  • JavaScript programming. You can create your own algorithm to select and rename files;
  • EXIF attributes of photo files. These are specified using substitution tags (placed in parentheses in the list below), which you key into the Prefix, Insert or Suffix boxes. Supported attributes are aperture (%a), comments (%c), Exposure (%e), focal length (%f), exposure bias (%xb), camera make (%ma) and camera model (%mo);
  • ID3 tags V1 and V1.1. Supported tags are artist (%r), album (%l), title (%t) and track number (%k).

Advanced Renamer

Advanced Renamer is another free multiple file rename tool. There are no panels with dropdown menus to setup rename options. This application provides methods with special syntax to form new file names. In the left part, you can find method browser where you can find, add and edit rename options. The file list is located at the right center part of the window. You need to add files by drag and drop or using dialog window Add Files. Then click on Start batch button.

Let's see it in action with our test rename task.

Advanced Renamer in action

Advanced Renamer has much better support for EXIF attributes and ID3 tags compared to Bulk Rename Utility. If that is important you may choose it for renaming.

Each presented solution has limitations and advantages. There are a lot more tools and applications for that purpose. Would be great to see your way of how to rename multiple files. If you have some problems, please also share in comments.

19 April 2018 7 October 2019 9183

More like this

How to install and play original Doom on Mac

Quakespasm. User manual. How to install, setup and play Quake 1

How to play Terraria multiplayer with Steam friends

How to set Nginx to return 410 (Gone) HTTP response status code for certain pages?

How to remove a color banding (steps) and smooth a gradient in Photoshop?

Add a Comment


admin · July 28, 2020 02:05 PM  
Christian, this is pretty tricky
Christian · July 21, 2020 10:20 AM  
my problem is, all the files are already named without the preceding 0's and I can't get it to rename them in the correct order using powershell, it always wants to make 10 -> 002 etc, any help? is there a way to just insert a variable number of zeros?