How to batch rename files in Windows
Number a folder of holiday photos, put the date in front of every scan, or replace spaces with dashes. Here are three ways to rename many files at once on Windows 10 and 11, from quickest to most flexible.
1. File Explorer: same name plus a number
Windows can rename a group of files to one name with a number in brackets. No extra software needed.
- Open the folder in File Explorer and select the files (CtrlA selects all).
- Press F2.
- Type the new name, for example
Iceland, and press Enter.
The files become Iceland (1).jpg, Iceland (2).jpg, Iceland (3).jpg and so on. Extensions are kept.
Limits: that's the only pattern. You can't choose the number format, add dates, keep part of the old name, or replace text. For anything more, use one of the methods below.
2. PowerShell: any rule you can script
PowerShell comes with Windows and can rename files with any rule. Open the folder in File Explorer, type powershell in the address bar and press Enter, then use one of these.
Number files with leading zeros
$i = 1
Get-ChildItem *.jpg | Sort-Object Name | ForEach-Object {
Rename-Item $_ -NewName ('Iceland-{0:D2}{1}' -f $i, $_.Extension)
$i++
}
Result: Iceland-01.jpg, Iceland-02.jpg… Change D2 to D3 for three digits.
Replace spaces with dashes
Get-ChildItem -File | Where-Object Name -like '* *' |
Rename-Item -NewName { $_.Name -replace ' ', '-' }
Put the date modified in front
Get-ChildItem -File | Rename-Item -NewName {
$_.LastWriteTime.ToString('yyyy-MM-dd') + ' ' + $_.Name
}
Add -WhatIf to the end of Rename-Item to see what would happen without renaming anything. PowerShell has no undo, so try it on a copy of the folder first.
Limits: you need to get the script right, there's no preview unless you use -WhatIf, and reading photo EXIF dates or music tags takes a lot more code.
3. FilesPro: patterns with a live preview and undo
FilesPro is a file manager for Windows with a built-in batch rename. You type a pattern, see every new name before anything changes, and can undo the whole batch in one step, even after a restart.
- Select the files in FilesPro.
- Press CtrlM (or open the command palette with CtrlShiftP and type batch rename).
- Type a pattern, for example
Iceland-{n:2}{ext}. Set Start and Step for the counter if you need them. - Optionally add Find and Replace with (tick Regular expression for patterns), and a Case change: lowercase, UPPERCASE or Title Case. The case change leaves the extension alone.
- Check the preview. Names that Windows doesn't allow, names that end with a period or space, reserved names like
CON, and names that clash with each other or with other files are flagged before you rename. - Press Rename. Changed your mind? CtrlZ undoes the whole batch.
Pattern tokens
| Token | Becomes | Example |
|---|---|---|
{name} | Original name, without the extension | Black sand beach |
{ext} | Original extension, with the dot | .jpg |
{n} | Counter (set Start and Step) | 1, 2, 3 |
{n:3} | Counter padded with zeros | 001, 002, 003 |
{date} | Date modified (yyyy-MM-dd) | 2026-09-14 |
{date:yyyyMMdd} | Date modified, any .NET date format | 20260914 |
{taken} | Photo's EXIF date taken (also takes a format) | 2026-09-14 |
{camera} | Camera model from EXIF | X-T5 |
{width} {height} | Image size in pixels | 1600 1000 |
{artist} {album} {title} | Music tags (ID3) | Aurora |
{track} {track:2} | Track number, optionally padded | 7, 07 |
{year} {genre} | More music tags | 2026 |
{parent} | Name of the folder the file is in | Iceland trip |
Examples
| Pattern | Before | After |
|---|---|---|
Iceland-{n:2}{ext} | Black sand beach.jpg | Iceland-01.jpg |
{taken} {name}{ext} | IMG_4021.jpg | 2026-09-14 IMG_4021.jpg |
{parent} {n:3}{ext} | IMG_4021.jpg (in Iceland trip) | Iceland trip 001.jpg |
{track:2} - {artist} - {title}{ext} | audio_07.mp3 | 07 - Aurora - Runaway.mp3 |
{date:yyyyMMdd}_{name}{ext} | Report.pdf | 20261018_Report.pdf |
Find and replace runs after the pattern. For example, find \s+ and replace with - with Regular expression ticked turns every run of spaces into a single dash.
Tips that save you from a mess
- Sort first. Counters follow the order files are processed in. Sort by name or date before you number them.
- Always keep the extension. End patterns with
{ext}(FilesPro) or$_.Extension(PowerShell), or Windows won't know how to open the files. - Pad numbers.
01…10sorts correctly;1…10puts 10 after 1. - Use the date taken for photos. The date modified changes when you edit or copy a photo; the EXIF date taken doesn't.
- Make sure you can go back. Test on a copy, use
-WhatIf, or use a tool with undo.
Frequently asked questions
Can I batch rename files in Windows without software?
Yes. Select the files in File Explorer and press F2 to give them one name with a number, or use PowerShell's Rename-Item for any other rule.
How do I rename files with numbers in order?
Sort the files the way you want, then use a counter: {n:2} in FilesPro gives 01, 02, 03; in PowerShell use '{0:D2}' -f $i and increase $i for each file.
Can I rename photos by the date they were taken?
Yes, with a tool that reads EXIF data. In FilesPro use {taken}, for example {taken:yyyy-MM-dd} {name}{ext}.
Can I undo a batch rename?
PowerShell can't undo. FilesPro undoes a whole batch with Ctrl+Z, many steps deep, and keeps that history across restarts.