How to Copy File using PowerShell?

Use the below command to copy a file using PowerShell.

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

Please find the illustration below:

Suppose we have to copy a file “TextFile.txt” to some other folder. We can use any one of below command.

Copy-Item -Path "E:\Test\Check\TextFile.txt" -Destination "E:\Test\Power\TextFile.txt"
Copy-Item -Path "E:\Test\Check\TextFile.txt" -Destination "E:\Test\Power"

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

 Copy-Item -Path "E:\Test\Check\TextFile.txt" -Destination "E:\Test\Power\Text123.txt"

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

Up ↑

%d bloggers like this: