Skip to content

Copy-Item

The Copy-Item cmdlet in PowerShell is used to copy files and directories from one location to another.

Here’s how to use Copy-Item:

  1. Open PowerShell by searching for it in the Start menu or by pressing Win + X and selecting “Windows PowerShell” or “Windows PowerShell (Admin)”.
  2. Once PowerShell is open, you can use the Copy-Item cmdlet followed by the path of the item you want to copy and the destination path where you want to copy it. For example:
  • To copy a file: Copy-Item -Path C:\Path\ToFile.txt -Destination D:\Destination
  • To copy a directory and all its contents recursively: Copy-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.
  1. After executing the Copy-Item cmdlet with the desired parameters, PowerShell will copy the specified item(s) to the destination location.

Source for More Information

Here’s a source where you can find more detailed information about Copy-Item and other PowerShell cmdlets:

The Microsoft Docs page provides comprehensive documentation on PowerShell cmdlets, including Copy-Item, with detailed explanations, examples, and usage scenarios.

Leave a Reply

Your email address will not be published. Required fields are marked *