Move-Item
Use Move-Item to move a file or directory to a new location, and rename it if you change the leaf name.
Documentation: Microsoft Learn — Move-Item
Syntax
See the command anatomy
Read the command and its supplied arguments. This example requires real PowerShell or its module; this diagram does not execute it.
Move-Item [-Path] <String[]> [[-Destination] <string>] [-Force] [-PassThru] [-WhatIf] [-Confirm] [<CommonParameters>]- Stage 1Move-Item
-Path -Destination -Force -PassThru -WhatIf -Confirm
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.
Follow the objects
Run the command to inspect each stage.
Examples
Move-Item -Path 'C:\Scripts\Backup-Files.ps1'
Show reference output
Sample output · fictional data, shaped like the real thing
Directory: C:\Scripts\Archive Mode LastWriteTime Length Name ---- ------------- ------ ---- -a---- 9/28/2026 9:04 AM 1985 Cleanup-Old.ps1 -a---- 10/12/2025 11:47 AM 2418 Backup-Files.ps1
Move-Item -Path 'C:\Temp\old.txt'
Show reference output
Sample output · fictional data, shaped like the real thing
Directory: C:\Temp Mode LastWriteTime Length Name ---- ------------- ------ ---- -a---- 10/9/2026 1:58 PM 312 new.txt
Move-Item -Path 'C:\Scripts\*.log'
Show reference output
Sample output · fictional data, shaped like the real thing
Directory: C:\Temp Mode LastWriteTime Length Name ---- ------------- ------ ---- -a---- 10/9/2026 8:02 AM 4120 app.log -a---- 10/8/2026 5:47 PM 1874 debug.log
Parameters
Parameter definitions:
-Path-Destination-Force-PassThru-WhatIf-Confirm
Practical use and troubleshooting
Practical scenario: Use Move-Item when you need to move a file or directory to a new location, and rename it if you change the leaf name. Start with one identified target and inspect the returned values before extending the operation to a list. Keep the identity in your report so you can trace each result back to the object or path that produced it.
Common error and fix: Access denied may mean the source file is open or the destination ACL rejects writes. Close the owning application when appropriate and verify both source and destination permissions. In an unattended script, capture this failure with its original error record and record which target failed. An empty result and an unsuccessful query must remain distinguishable in the final report.
See also: Rename-Item. Move-Item can relocate an item; Rename-Item changes its name without selecting another destination directory. Check the destination before moving a group of files. Read the linked command before substituting it; similar names do not imply identical inputs or output.
Recap
Move-Item Use Move-Item to move a file or directory to a new location, and rename it if you change the leaf name.
Next: New-Item