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.

Copy-Item
   [-Path] <String[]>
   [-LiteralPath] <String[]>
   [[-Destination] <String>]
   [-Container]
   [-Force]
   [-Filter <String>]
   [-Include <String[]>]
   [-Exclude <String[]>]
   [-Recurse]
   [-PassThru]
   [-Credential <PSCredential>]
   [-WhatIf]
   [-Confirm]
   [-FromSession <PSSession>]
   [-ToSession <PSSession>]
   [<CommonParameters>]

Copy-Item cmdlet aliases are copy and cp.

Updated on: 12-Mar-2020

258 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements