Move-Item
Move or rename by moving
Move-Item -Path .\notes.txt -Destination .\archive\notes.txt
- Works on
- WindowsLinuxmacOS
- PowerShell
- 5.1 and later
- Reference
- Microsoft Learn: Move-Item
Careful: Move-Item deletes the source. Use Copy-Item if you still need the original.
- PowerShell 7 On Linux and macOS, mv runs the system command instead of this cmdlet. Type the full cmdlet name there.
Moves a file or folder. If the destination is on the same drive, this is a rename/move. Across drives it copies then deletes.
Always pass -WhatIf the first time.
Try this
Move-Item -Path .\notes.txt -Destination .\archive\ -WhatIf
Coming from another shell
| Shell | What you might type |
|---|---|
| bash / zsh | mv notes.txt archive/ |
| cmd.exe | move notes.txt archive\ |
More in From bash and From cmd.