Rename-Item
Use Rename-Item to rename a file, folder, or registry key — and to bulk-rename hundreds of files in one pipeline.
Documentation: Microsoft Learn — rename-item
Syntax
Try it
PowerShell example · browser support is limited.
Execution scope: The full example below requires PowerShell outside this browser. You can edit this runner to use the supported practice commands; unsupported syntax returns an explanation.
Examples
Rename a single file
Show reference output
Illustrative output · values vary by environment
(no output; the file is now new-report.txt)
Bulk-rename files by replacing part of the name
Show reference output
Illustrative output · values vary by environment
(draft-report.txt becomes final-report.txt, and so on)
Rename and confirm what changed
Show reference output
Illustrative output · values vary by environment
Directory: C:\Docs Mode LastWriteTime Length Name ---- ------------- ------ ---- -a--- 2026-10-24 512 archive.txt
Parameters
Parameter definitions:
-Path— The item to rename. Accepts wildcards.-NewName— The new name only — not a full path. To move and rename, use Move-Item instead.-Force— Renames read-only or hidden items, and overwrites an existing item with the same name.-PassThru— Returns the renamed item so you can confirm or pipe it onward.
NewName is a name, not a path
The most common Rename-Item error is passing a full path to -NewName. It accepts only the new name itself: -NewName 'report.txt', never -NewName 'C:\Docs\report.txt'. To change the folder as well, use Move-Item, which renames and moves in one step.
For bulk renames, pipe Get-ChildItem into Rename-Item with a script block for -NewName. Inside the block, $_ is the current file, so $_.Name -replace 'old','new' renames every file by the same rule. Always run with -WhatIf first to preview a bulk rename.
A rename fails if the file is open in another program or the destination name already exists. Close the file first, or add -Force to overwrite the destination.
Move and rename with Move-Item
List files to rename with Get-ChildItem
Updated 25 October 2026. Browser outputs are fictional; check the installed module help for your environment.
Recap
Rename-Item Use Rename-Item to rename a file, folder, or registry key — and to bulk-rename hundreds of files in one pipeline.
Next: New Localuser