← All articles

How to Batch Rename Files in Windows with PowerRename and PowerShell

Use Microsoft PowerToys PowerRename or PowerShell to preview and apply advanced bulk file-renaming rules in Windows 10 and 11.

By Shantanu2 min read
Illustration of file cards being renamed through an automated command workflow.

Windows File Explorer can apply one common base name to a group of files, but more advanced jobs—removing text, replacing prefixes, changing case, or applying patterns—are easier with PowerRename from Microsoft PowerToys or with PowerShell.

This is the advanced companion to the simpler File Explorer batch-renaming guide.

Before you start

Bulk renaming can affect hundreds of files at once. Before applying a rule:

  • work on a copy if the filenames are important;
  • enable View > Show > File name extensions in File Explorer when extensions matter;
  • preview the result before committing it;
  • test a PowerShell command with -WhatIf first.

Method 1: PowerRename in Microsoft PowerToys

PowerRename is Microsoft’s bulk-renaming utility for Windows. It provides a live preview and supports search-and-replace, regular expressions, case changes, metadata, and enumeration.

  1. Install Microsoft PowerToys from Microsoft.
  2. Make sure PowerRename is enabled in PowerToys settings.
  3. In File Explorer, select the files or folders you want to rename.
  4. Right-click the selection and choose Rename with PowerRename.
  5. Enter the text or pattern to search for.
  6. Enter the replacement text.
  7. Review the Preview column carefully.
  8. Select Apply/Rename when the preview is correct.

Useful PowerRename options include:

  • regular-expression matching;
  • case-sensitive matching;
  • filename-only or extension-only changes;
  • including files, folders, or subfolders;
  • case conversion;
  • item enumeration.

File Explorer can normally undo the last rename operation with Ctrl + Z immediately afterward.

Method 2: PowerShell

PowerShell is useful when you need a repeatable rule. Open PowerShell in the target folder or use Set-Location to move to it.

Add a prefix

Preview first:

Get-ChildItem -File | Rename-Item -NewName { "Project_$($_.Name)" } -WhatIf

If the preview is correct, run the same command without -WhatIf.

Replace spaces with underscores

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

Add a suffix before each extension

Get-ChildItem -File | Rename-Item -NewName { "$($_.BaseName)_Edited$($_.Extension)" } -WhatIf

After checking the proposed names, remove -WhatIf to perform the rename.

When to use File Explorer instead

If all you need is a common base name such as Holiday (1).jpg, Holiday (2).jpg, and so on, File Explorer is faster. Select the files, press F2, type the base name, and press Enter.

Official references