Deployn

5 Ways to Rename Multiple Files at Once on Windows 11/10

Rename files in batches on Windows 10 and 11. Number photos, replace text in filenames, or assign each file its own name.

5 Ways to Rename Multiple Files at Once on Windows 11/10 hero image
Contents

Why Rename Multiple Files on Windows?

This guide is for anyone with a folder of photos or documents to rename on Windows 10 or 11. It shows how to number the files, replace text in their names, or assign a different name to each one. On macOS or Linux, use that system’s batch-renaming tools.

How to rename a file in Windows 11

Select the file in File Explorer, press F2, type the new name, and press Enter. For a file like Report.pdf, F2 selects Report so you can change the name while keeping .pdf.

How to rename all files in a folder at once

In Windows File Explorer, open the folder, select the files, press F2, type a shared name, and press Enter. Windows gives files with the same extension numbered names such as Photo (1).jpg and Photo (2).jpg.

Using File Explorer to Bulk Rename Files

  1. Open File Explorer Win + E.
  2. Navigate to the folder with the files you want to rename.
  3. Select the files to be renamed. To select all files, use Ctrl + A. For multiple selections, hold Ctrl and click on the desired files.
  4. Press F2 or right-click on a selected file and choose “Rename” from the context menu.
  5. Type in the new name for the group of files.
  6. Press Enter to apply the name change.

Renaming multiple files at once in Windows 11 File Explorer

You can undo the batch rename in File Explorer with Ctrl + Z.

Renaming Files using the Command Prompt (CMD)

Use the Command Prompt (CMD) to run several ren commands in one batch.

  1. Open the command prompt via the Start menu or with Win + R, then type cmd.
  2. Navigate to your folder using cd. You can change the directory with cd followed by the directory name. Use cd .. to move up a level. If you are in your personal user folder, you can change to the desktop directory with cd Desktop. Folders with spaces need to be enclosed in quotes. Verify your files are present with dir.
  3. Utilize ren to rename files.

For instance:

cmd
ren old-file.txt new-file.txt

To rename multiple files, chain commands together:

cmd
ren old-file.txt new-file.txt & ren old-file2.txt new-file2.txt

Placeholders like * for any string and ? for a single character can help with broader changes:

cmd
ren *.txt *.md

CMD

However, this method has limitations when renaming multiple files with different names.

It is possible to save ren commands in a batch file and execute them.

For example, I create a text file named rename.txt and insert the following content.

batch
@echo off
setlocal enabledelayedexpansion

for %%F in (*.txt) do (
  set "filename=%%~nF"
  ren "%%F" "new_!filename!.txt"
)

endlocal

After the file and its contents have been saved, I change the file extension from .txt to .bat. Now I can execute the file, and all files with the extension .txt are renamed new_*.txt.

Renaming Files in PowerShell

Use PowerShell when you want to rename files by a rule, such as adding the last modified date to each filename.

  1. Open the desired folder in File Explorer.

  2. Open PowerShell in your target folder by holding Shift and right-clicking, then choosing “Open PowerShell window here.” You can also navigate using cd.

Open PowerShell

  1. Use the command Get-ChildItem to list all files in the current directory. With Get-ChildItem *.txt all files with the extension .txt are listed. Get-ChildItem -File lists all files.

  2. Rename using Rename-Item.

Add Prefixes

Terminalpowershell
Get-ChildItem -File | Rename-Item -NewName { "hallo_" + $_.Name }

This adds the prefix “hallo_” to all files.

Add Suffixes

Terminalpowershell
Get-ChildItem *.txt | Rename-Item -NewName { $_.Name + "_hallo" }

This adds the suffix “_hallo” to all files with the extension .txt. This means the file file.txt is renamed file.txt_hallo. However, this is probably not the desired result. The file name must be broken down into components to achieve this.

Terminalpowershell
Get-ChildItem *.txt | Rename-Item -NewName { $_.BaseName + "_hallo" + $_.Extension }

Delete characters

Terminalpowershell
Get-ChildItem -File | Rename-Item -NewName { $_.Name.Remove(0, 5) }

This removes the first 5 characters from all files (regardless of the extension).

Add characters

Terminalpowershell
Get-ChildItem -File | Rename-Item -NewName { $_.Name.Insert(2, "test_") }

This inserts the string “test_” after the second position in the name of all files.

Replacing part of the name

Terminalpowershell
Get-ChildItem *.txt | Rename-Item -NewName { $_.Name -replace 'file', 'new-file' }

This command renames all files with the extension .txt by replacing the string “file” with “new-file”. This means that the file file.txt is renamed to new-file.txt and the file textfile.txt is renamed to textnew-file.txt. The files nocheine.txt and exceldatei.xlsx remain unchanged.

Add random characters

Terminalpowershell
Get-ChildItem -File | Rename-Item -NewName { $_.Name.Insert(0, [System.IO.Path]::GetRandomFileName()) }

This inserts a random string as a prefix for all files.

Random Naming

Terminalpowershell
Get-ChildItem -File | Rename-Item -NewName { $_.Name -replace $_.BaseName, [System.IO.Path]::GetRandomFileName() }

This randomly renames all files. The file extension is retained.

File names in capital letters

Terminalpowershell
Get-ChildItem -File | Rename-Item -NewName { $_.BaseName.ToUpper() + $_.Extension }

This renames all files to upper case.

File names in lowercase letters

Terminalpowershell
Get-ChildItem -File | Rename-Item -NewName { $_.BaseName.ToLower() + $_.Extension }

This renames all files to lowercase.

Remove spaces

Terminalpowershell
Get-ChildItem -File | Rename-Item -NewName { $_.Name -replace ' ', '' }

This removes all spaces from the file names.

Last modified date as a prefix

Terminalpowershell
Get-ChildItem -File | Rename-Item -NewName { $_.LastWriteTime.ToString("yyyyMMdd") + "_" + $_.Name }

This adds the last write access date as a prefix to all files.

File size as prefix

Terminalpowershell
Get-ChildItem -File | Rename-Item -NewName { "Size_" + $_.Length + "_" + $_.Name }

This adds the file size in bytes as a prefix to all files.

Folder name as prefix

Terminalpowershell
Get-ChildItem -File | Rename-Item -NewName { $_.Directory.Name + "_" + $\_.Name }

This adds the parent folder’s name as a prefix to all files.

Use Regular Expressions for Renaming

Regular expressions (regex) let you match parts of a filename in PowerShell. Try a pattern against a few sample filenames in the regex tester before running Rename-Item.

  1. . (dot): Matches any single character except newline. Example: file. matches “file1”, “fileA”, etc.

  2. * (asterisk): Matches zero or more of the preceding character. Example: file.* matches “file”, “file.txt”, “file.docx”, etc.

  3. + (plus): Matches one or more of the preceding character. Example: file.+ matches “file1”, “file.txt”, but not “file”.

  4. ? (question mark): Matches zero or one of the preceding character. Example: files? matches “file” and “files”.

  5. ^ (caret): Matches the start of a string. Example: ^2024 matches filenames starting with “2024”.

  6. $ (dollar): Matches the end of a string. Example: .txt$ matches filenames ending with “.txt”.

  7. [] (square brackets): Matches any single character in the brackets. Example: file[123] matches “file1”, “file2”, “file3”.

  8. [^] (caret in square brackets): Matches any single character not in the brackets. Example: file[^123] matches “fileA” but not “file1”.

  9. (): Groups patterns together. Example: (file|doc) matches “file” or “doc”.

  10. \d: Matches any digit (0-9). Example: \d{3} matches exactly three digits.

  11. \w: Matches any word character (a-z, A-Z, 0-9, and _). Example: \w+ matches one or more word characters.

  12. \s: Matches any whitespace character (space, tab, newline). Example: \s+ matches one or more whitespace characters.

  13. {n}: Matches exactly n occurrences of the preceding character or group. Example: \d{4} matches exactly four digits.

  14. {n,m}: Matches between n and m occurrences of the preceding character or group. Example: \d{2,4} matches between two and four digits.

Example:

Terminalpowershell
Get-ChildItem | Where-Object { $_.Name -match '^IMG_\d{4}\.jpg$' } |
ForEach-Object { Rename-Item $_ -NewName ('Photo_' + $_.Name) }

This renames all files matching the pattern “IMG*####.jpg” to “Photo_IMG*####.jpg”.

The Microsoft Rename-Item reference lists the available parameters.

How to rename multiple files at once with different names

Use the Excel and PowerShell method to give each file its own new name. Put each original filename in column A and its replacement in column B, including the file extension in both columns.

Additional Tools and Techniques

Excel for Batch Renaming

Use Excel to pair each original filename with its replacement and generate the PowerShell commands.

  1. Export file names to CSV using PowerShell:
Terminalpowershell
Get-ChildItem -File | Select-Object Name | Export-Csv -Path .output.csv -NoTypeInformation
  1. Open the CSV in Excel.

A table can now be created from which the file names can be changed. Formulas can also be used to change the file names.

In my case, I have the exported file names in column A (Name) and the new file names in column B (NewName). Column B can also remain empty if the file names are not to be changed. The file extension must be retained.

If the replacement names are on a separate sheet, use VLOOKUP between two sheets to fill column B by matching the original filenames.

  1. Create a third column with a formula that renames the files. To do this, use the function CHAR(34) to insert quotation marks into the formula. The formula in cell C2 then looks like this:
excel
=SWITCH(TRUE, LEN(B2)>1, "Rename-Item -Path " & CHAR(34) & A2 & CHAR(34) & " -NewName " & CHAR(34) & B2 & CHAR(34),"")

The formula can then be copied down.

Excel formula

  1. Copy the generated PowerShell command (without the heading) and execute them to rename files.

  2. The files are renamed.

Third-party Software Solutions

Bulk Renaming Files with PowerToys PowerRename

Install Microsoft PowerToys, select the files in File Explorer, and open PowerRename from the context menu.

  • Search for: Text to find and replace in the filenames
  • Replace with: Replacement text for the search term
  • Use regular expressions: Allows using regex for complex renaming
  • Enumerate items: Sequentially numbers the renamed files
  • Item name format: Customize the format
  • Exclude files: Skip renaming certain files

PowerRename

Check the proposed names on the right, then click Rename to apply them.

The Windows 11 setup guide also covers PowerToys installation.

On Windows 11, how do i rename a set of image files in one action so they are all renamed in an order

Select the images in File Explorer and use PowerRename to number them in one batch. Set Apply to to Filename only, enable Use regular expressions and Enumerate items, then replace ^.+$ with Image_${padding=3;start=1} and check the preview for Image_001.jpg, Image_002.jpg, and so on before applying.

Renaming Safeguards

When renaming files in bulk, take these precautions:

  • Back up data to prevent loss.
  • Test renaming methods on a small group first.
  • Be cautious with wildcards or regex to avoid unintended changes.

Best Practices for File Naming Conventions

  1. Use consistent naming conventions across projects or folders.
  2. Avoid special characters (\ / : * ? “ < > |) which can cause issues in some systems.
  3. Use underscores (_) or hyphens (-) instead of spaces for better compatibility.
  4. Include dates in YYYYMMDD format for easy chronological sorting.
  5. Use descriptive names that indicate the content of the file.
  6. Keep filenames relatively short while still being descriptive.
  7. Use leading zeros (001, 002, etc.) to ensure proper sorting.
  8. Consider including project or client names in filenames for easy identification.