PowerShell copy file and rename

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:

PowerShell copy file and rename
PowerShell copy file and rename

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"
PowerShell copy file and rename
PowerShell copy file and rename
PowerShell copy file and rename
PowerShell copy file and rename
PowerShell copy file and rename
PowerShell copy file and rename

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"
PowerShell copy file and rename
PowerShell copy file and rename

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


Share this:

  • Tweet
  • WhatsApp
  • Email
  • Telegram
  • More
  • Print
  • Share on Tumblr
  • PowerShell copy file and rename
    PowerShell copy file and rename
  • Pocket

Like this:

Like Loading...

Related