Site icon JD Bots

How to Move File using PowerShell?

Photo by Andrew Neel on Pexels.com

Move Files from one folder or directory to another folder or directory using the PowerShell. This is helpful in PowerShell Automation scripts.

Use the below command to copy a file using PowerShell.

Move-Item -Path "path\of\file\to\be\copied" -Destination "path\where\to\copy\the\file"

Please find the illustration below:

Suppose we have to move a file “TextFile.txt” to “check” folder (as shown above). We can use any one of below command.

Move-Item -Path "D:\Test\TextFile.txt" -Destination "D:\Test\check"
Move-Item -Path "D:\Test\TextFile.txt" -Destination "D:\Test\check\TextFile.txt"

You can also rename file in destination folder using this command. For example.

Move-Item -Path "D:\Test\TextFile.txt" -Destination "D:\Test\check\Text123.txt"

Thank you All!!! Hope you find this useful.


Exit mobile version