What is Copy-item in PowerShell used for?

Copy-Item in PowerShell cmdlet is used for copying items from one location to another location in the same namespace. Here, the namespace meaning, you can copy items from files to the different folders but cannot files to the registry or the certificate store.

This cmdlet doesn’t delete or cut the item from the source location instead, it copies the item to the destination folder with the same name or the different name.

Copy-Item Syntax with parameters in PowerShell is as below.

   [-Path] <String[]>
   [-LiteralPath] <String[]>
   [[-Destination] <String>]
   [-Filter <String>]
   [-Include <String[]>]
   [-Exclude <String[]>]
   [-Credential <PSCredential>]
   [-FromSession <PSSession>]
   [-ToSession <PSSession>]

Copy-Item cmdlet aliases are copy and cp.

Updated on: 12-Mar-2020


Kickstart Your Career

Get certified by completing the course

Get Started