PowerShell Logo Small

Copy-Item



This is the built-in help made by Microsoft for the command 'Copy-Item', in PowerShell version 2 - as retrieved from Windows version 'Microsoft® Windows Vista™ Ultimate ' PowerShell help files on 2016-06-23.

For PowerShell version 3 and up, where you have Update-Help, this command was run just before creating the web pages from the help files.

SYNOPSIS

Copies an item from one location to another within a namespace.

SYNTAX


Copy-Item [-LiteralPath] <string[]> [[-Destination] <string>] [-Container] [-Credential <PSCredential>] [-Exclude <string[]>] [-Filter <string>]
[-Force] [-Include <string[]>] [-PassThru] [-Recurse] [-Confirm] [-WhatIf] [-UseTransaction] [<CommonParameters>]
Copy-Item [-Path] <string[]> [[-Destination] <string>] [-Container] [-Credential <PSCredential>] [-Exclude <string[]>] [-Filter <string>] [-Force
] [-Include <string[]>] [-PassThru] [-Recurse] [-Confirm] [-WhatIf] [-UseTransaction] [<CommonParameters>]



Search powershellhelp.space

DESCRIPTION


The Copy-Item cmdlet copies an item from one location to another in a namespace. Copy-Item does not delete the items being copied. The particular
items that the cmdlet can copy depend on the Windows PowerShell providers available. For example, when used with the FileSystem provider, it can
copy files and directories and when used with the Registry provider, it can copy registry keys and entries.



<

RELATED LINKS

Online version: http://go.microsoft.com/fwlink/?LinkID=113292
about_Providers
Clear-Item
Get-Item
Invoke-Item
Move-Item
Set-Item
New-Item
Remove-Item
Rename-Item

REMARKS

<

Examples


-------------------------- EXAMPLE 1 --------------------------

C:\PS>copy-item C:\Wabash\Logfiles\mar1604.log.txt -destination C:\Presentation



Description
-----------
This command will copy the file mar1604.log.txt to the C:\Presentation directory. The command does not delete the original file.








-------------------------- EXAMPLE 2 --------------------------

C:\PS>copy-item C:\Logfiles -destination C:\Drawings -recurse



Description
-----------
This command copies the entire contents of the Logfiles directory into the Drawings directory. If the source directory contains files in subdirec
tories, those subdirectories will be copied with their file trees intact. The Container parameter is set to true by default. This preserves the d
irectory structure.








-------------------------- EXAMPLE 3 --------------------------

C:\PS>copy-item C:\Logfiles -destination C:\Drawings\Logs -recurse



Description
-----------
This command copies the contents of the C:\Logfiles directory to the C:\Drawings\Logs directory. It will create the subdirectory \Logs if it does
not already exist.