Use the below command to copy a file using PowerShell.
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.
PowerShell
Copy-Item -Path "E:\Test\Check\TextFile.txt" -Destination "E:\Test\Power\TextFile.txt"
PowerShell
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.
PowerShell
Copy-Item -Path "E:\Test\Check\TextFile.txt" -Destination "E:\Test\Power\Text123.txt"

Thank you All!!! Hope you find this useful.
Advertisement
0 comments