ThisCalculator

Everyday

Batch Rename Files in Windows: Step-by-Step

Updated · Standard formula, shown below

Batch Rename Files in Windows: Step-by-Step

This guide shows you how to rename multiple files at once in Windows, saving you from the tedious task of renaming each file individually. You’ll learn several built-in methods, from the quick File Explorer trick to using Command Prompt for more control. By the end, you’ll be able to rename batches of photos, documents, or any files in seconds.

What You’ll Need

  • A Windows PC (10 or 11 recommended, but steps work on 8/8.1)
  • The files you want to rename, stored in one folder (you can select subfolders if needed)
  • Basic familiarity with File Explorer and, optionally, Command Prompt

Step-by-Step

  1. Open File Explorer and navigate to the folder containing the files you want to rename.
  2. Select the files you want to rename. You can click the first file, then hold Shift and click the last file to select a contiguous group, or hold Ctrl and click individual files to select non-adjacent ones. To select all files, press Ctrl+A.
  3. Rename the first file in the selection. Click once on the first file’s name (or press F2), type the new base name (e.g., “Vacation Photo”), and press Enter.
  4. Watch the magic happen: Windows automatically renames all selected files to the base name followed by a number in parentheses, like Vacation Photo (1).jpg, Vacation Photo (2).jpg, and so on. The numbering starts at 1 and continues in the order of the original file names.
  5. Undo if needed: If you don’t like the result, press Ctrl+Z immediately to revert the rename.

That’s the simplest method. For more advanced renaming (e.g., adding a date, changing extensions, or replacing text), use Command Prompt or PowerShell:

  1. Open Command Prompt or PowerShell in the folder. In File Explorer, click the address bar, type cmd (or powershell) and press Enter. This opens the command window with the current folder as the working directory.
  2. Use the ren command to rename files with patterns. For example, to rename all .txt files to .md, type: ren *.txt *.md and press Enter.
  3. To add a prefix to all files, use: ren *.* prefix_* (this adds “prefix_” to the beginning of each file name).
  4. To replace text in file names, use a loop in PowerShell. For example, to replace “old” with “new” in all .jpg files: Get-ChildItem *.jpg | Rename-Item -NewName { $_.Name -replace 'old','new' }

Common Mistakes

  • Not selecting all files: If you only want to rename some files, make sure you select exactly those. The rename applies to all selected files.
  • Using special characters: Windows doesn’t allow \ / : * ? " < > | in file names. If you include them, the rename will fail.
  • Renaming files that are open: If a file is open in a program, Windows may not rename it. Close the file first.
  • Overwriting existing files: If the new names conflict with existing files, Windows will ask for confirmation or fail. Be careful when using patterns that might create duplicates.

Tips

  • Use the numbering starting point: In File Explorer, the numbering always starts at 1. If you need a different start, use PowerShell: Get-ChildItem | Sort-Object Name | ForEach-Object -Begin {$i=100} -Process { Rename-Item $_ -NewName ("File{0:D3}.jpg" -f $i++) } (this starts at 100 with three-digit padding).
  • Preview before renaming: In PowerShell, you can use -WhatIf to preview changes: Get-ChildItem *.txt | Rename-Item -NewName { $_.Name -replace 'txt','md' } -WhatIf
  • Use the right tool: For simple sequential renaming, File Explorer is fastest. For complex patterns, PowerShell is more powerful.
  • Rename a single file quickly: Select the file, press F2, type the new name, and press Tab to rename the next file in the list.

Troubleshooting

  • Rename option is grayed out: This usually means you don’t have permission to rename the files (e.g., system files or files in protected folders). Try running File Explorer as administrator, or move the files to a user folder.
  • Files don’t rename as expected: If the numbering is not in the order you want, sort the files in File Explorer before selecting them. The rename order follows the current sort order.
  • Command Prompt says “The syntax of the command is incorrect”: Check that you’re using the correct pattern. For example, ren *.txt *.md works, but ren *.txt *.md* does not.
  • PowerShell error “Rename-Item : Cannot rename because item already exists”: This means the new name is already taken. Modify your pattern to avoid duplicates, or delete/move conflicting files first.
  • Files are read-only: If a file is marked read-only, you can’t rename it. Right-click the file, select Properties, and uncheck Read-only.

Frequently Asked Questions

Can I rename files with different extensions at once?

Yes, in File Explorer you can select files with different extensions and rename them all with the same base name; they will keep their original extensions. For example, selecting a.jpg and b.png and renaming to photo gives photo.jpg and photo.png.

How do I rename files to start with a specific number, like 001?

Use PowerShell with formatting. For example: Get-ChildItem | Sort-Object Name | ForEach-Object -Begin {$i=1} -Process { Rename-Item $_ -NewName ("File{0:D3}.jpg" -f $i++) } will create File001.jpg, File002.jpg, etc.

Can I undo a batch rename?

Yes, immediately after renaming, press Ctrl+Z in File Explorer to undo the last operation. This works for the File Explorer method. For Command Prompt or PowerShell, you’ll need to manually rename back or use a backup.

Why does Windows add numbers in parentheses?

That’s the default behavior for batch renaming in File Explorer to avoid duplicate names. If you want a different format, use PowerShell to control the exact naming pattern.

Is there a way to rename files without using any commands?

Yes, the File Explorer method (select files, press F2, type a name) is the simplest and requires no commands. For more advanced options, you can use third-party tools, but the built-in methods cover most needs.

Can I rename files in subfolders too?

Yes, in File Explorer you can select files across multiple folders by holding Ctrl and clicking, but it’s easier to use PowerShell with the -Recurse parameter: Get-ChildItem -Recurse | Rename-Item -NewName { ... }.

Related

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.