# Renaming: Rename-Item

Rename-Item gives a file or folder a new name in the folder it's already in; the new name is only a name, so renaming and moving in one step is Move-Item's job, and Rename-Item never replaces a file that already has the new name.

Novice · PowerShell · Operating System · Updated November 10, 2026

## After this lesson you can

- Rename a file or folder with Rename-Item, quoting names with spaces and keeping the extension
- Choose New-Item, Copy-Item, Move-Item or Rename-Item for a job on a file or folder

## Key takeaways

- `Rename-Item` gives a file or folder a new name and leaves it where it is: `Rename-Item resume.docx resume-2026.docx`.
- The new name is only a name. With a path in it, Rename-Item stops with an error; Move-Item moves and renames in one step.
- A name with spaces goes in quotes. Keep the extension, or Windows no longer knows which app opens the file.
- Rename-Item stops with an error rather than replace a file that already has the new name.

A job application asks for your résumé as `resume-2026.docx`, not `resume.docx`. Your phone names every photo something like `IMG_2041.jpg`, and the scanner calls everything `scan-1`. Renaming one file in File Explorer is quick (click it, press F2, type), and for one file that's a fine way to do it. PowerShell's `Rename-Item` does the same job from the keyboard, and in Module 3 the same command renames two hundred files in one line. This lesson gets one file right first.

This lesson keeps sorting the `downloads` folder from *Copy and Move: Copy-Item and Move-Item*. Go there first with `Set-Location ~\terminal-practice\downloads`.

## Rename-Item: the old name, then the new one

`Rename-Item` (read "rename item") takes the name it has now, then the name you want:

```powershell
Rename-Item resume.docx resume-2026.docx
Get-ChildItem resume-2026.docx
```

```text
    Directory: C:\Users\Sam\terminal-practice\downloads

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a---           8/31/2026  7:15 PM              0 resume-2026.docx
```

Like Copy-Item and Move-Item, it prints nothing when it works, so `Get-ChildItem` shows the result. Folders rename the same way: `Rename-Item backup backup-august`. The short name is `ren`.

## Spaces, and the extension

When a browser downloads a file twice, it often names the second one with `(1)` and a space, like `class-schedule (1).pdf`. Without quotes, PowerShell splits the name at the space, `(1).pdf` doesn't read as a name at all, and Rename-Item never gets the new name it needs:

```powershell
Rename-Item class-schedule (1).pdf class-schedule-old.pdf
```

```text
Rename-Item: Cannot bind argument to parameter 'NewName' because it is null.
```

Quotes keep the name in one piece, and Tab adds them for you:

```powershell
Rename-Item 'class-schedule (1).pdf' class-schedule-old.pdf
```

Rename-Item uses exactly the new name you write, extension or not. Leave off the `.mp3` and the playlist becomes a file Windows doesn't know how to open. `-WhatIf` shows the new name before it happens:

```powershell
Rename-Item road-trip-playlist.mp3 road-trip -WhatIf
```

```text
What if: Performing the operation "Rename File" on target "Item: C:\Users\Sam\terminal-practice\downloads\road-trip-playlist.mp3 Destination: C:\Users\Sam\terminal-practice\downloads\road-trip".
```

The Destination ends with `road-trip`, no `.mp3`. Rehearsed, that's a slip you fix before it happens.

## A name, not a path

The grocery receipt belongs in `receipts`. Rename-Item can't take it there:

```powershell
Rename-Item grocery-receipt.pdf receipts\grocery-receipt.pdf
```

```text
Rename-Item: Cannot rename the specified target, because it represents a path or device name.
```

The *old* name can be a path (`Rename-Item receipts\old-name.pdf new-name.pdf` renames a file in another folder), but the *new* name is a name only: Rename-Item never moves anything. To move a file and rename it in one step, use Move-Item with the new name at the end of the destination:

```powershell
Move-Item grocery-receipt.pdf receipts\groceries-august.pdf
Get-ChildItem receipts
```

```text
    Directory: C:\Users\Sam\terminal-practice\downloads\receipts

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a---           8/31/2026  7:15 PM              0 groceries-august.pdf
```

Rename-Item is careful in one more way. Ask for a name that's already taken, `Rename-Item class-schedule-old.pdf class-schedule.pdf`, and it stops with `Cannot create a file when that file already exists.` It never replaces the other file.

Windows PowerShell 5.1 runs everything in this lesson the same way. On a Mac or Linux, write paths with `/`, and capital letters count: `Report.pdf` and `report.pdf` are two different names there.

## Which command for the job?

You now have four commands that make or change files and folders. Pick by what should happen to the original:

- **New-Item:** nothing exists yet, and you want a new folder or file.
- **Copy-Item:** you want a second one, and the original stays.
- **Move-Item:** it should be somewhere else, with a new name on the way if you like.
- **Rename-Item:** it stays where it is, with a new name.

**Try it.** Without leaving `downloads`, rename the `resume.docx` in `backup` to `resume-old.docx` (the old name can be a path). Then rehearse renaming the whole `backup` folder with `-WhatIf`, and check the result with `Get-ChildItem backup`.

## Check yourself

2 questions to try on the lesson page.

## So what

A good name is how you find a file again next year. Rename-Item fixes one in place, and Move-Item renames on the way when it's going somewhere else anyway.

## Key terms

- [Rename-Item](https://www.ask-codey.com/glossary/rename-item)
- [File Extension](https://www.ask-codey.com/glossary/file-extension)
- [Move-Item](https://www.ask-codey.com/glossary/move-item)

## Cheat sheets

- [Renaming: Rename-Item](https://www.ask-codey.com/cheat-sheets/powershell-rename-item-cheat-sheet)

## Related

- [Copy and Move: Copy-Item and Move-Item](https://www.ask-codey.com/lessons/powershell-copy-and-move)
- [Wildcards and Filters](https://www.ask-codey.com/lessons/powershell-wildcards-and-filters)

Source: https://www.ask-codey.com/lessons/powershell-rename-item
