The Move-Item
cmdlet in PowerShell is used to move files and directories from one location to another. It effectively renames or relocates items within the file system.
Here’s how to use Move-Item
:
- Open PowerShell by searching for it in the Start menu or by pressing Win + X and selecting “Windows PowerShell” or “Windows PowerShell (Admin)”.
- Once PowerShell is open, you can use the
Move-Item
cmdlet followed by the path of the item you want to move and the destination path where you want to move it. For example:
- To move a file:
Move-Item -Path C:\Path\ToFile.txt -Destination D:\Destination
- To move a directory and all its contents recursively:
Move-Item -Path C:\Path\To\Directory -Destination D:\Destination -Recurse
- You can also use parameters such as
-Force
to overwrite existing items without prompting and-Verbose
to display detailed information about the operation.
- After executing the
Move-Item
cmdlet with the desired parameters, PowerShell will move the specified item(s) to the destination location.
Source for More Information
Here’s a source where you can find more detailed information about Move-Item
and other PowerShell cmdlets:
- Microsoft Docs: Move-Item cmdlet
The Microsoft Docs page provides comprehensive documentation on PowerShell cmdlets, including Move-Item
, with detailed explanations, examples, and usage scenarios.