Command referenceCopy-Item
Copy-Item command (Windows / PowerShell)
What it does
Copy items between locations supported by PowerShell providers. Guides covering the copy-item powershell usually need pipeline-friendly examples, common parameters, and how the cmdlet compares with classic CMD or Linux tools. This page includes syntax, options, and copyable PowerShell examples.
Copy items between locations supported by PowerShell providers.
Syntax
Copy-Item [-Path] <String[]> [[-Destination] <String>] [-Recurse] [-Force] [-PassThru]
Common options
| Flag / option | Meaning |
|---|---|
| -Destination | Set the target path. |
| -Recurse | Copy container descendants. |
| -Force | Copy items that cannot otherwise be changed. |
| -LiteralPath | Avoid wildcard interpretation. |
| -PassThru | Return copied item objects. |
Practical examples
Copy file
Copy-Item .\report.txt D:\Archive\
Copies the report into Archive.
Copy directory
Copy-Item .\Site D:\Backup\Site -Recurse
Copies the complete directory tree.
Copy selected files
Get-ChildItem *.csv | Copy-Item -Destination D:\Data
Pipelines CSV file objects into the copy operation.
Linux ↔ Windows equivalent
Closest match: cp (Linux / bash / sh / zsh). Copy files or directory trees to another location.
Common mistakes
- Forgetting `-Recurse` when copying a directory's contents.
- Assuming `-Force` overrides filesystem security permissions.
Related commands
- Move-ItemMove or rename items in filesystem and other providers.
- Remove-ItemDelete provider items such as files, directories, registry keys, and variables.
- copyCopy one or more files and optionally combine text or binary files.
- lsList directory entries and inspect file metadata.
- cdChange the shell's current working directory.
- dirList files and subdirectories with names, dates, sizes, and attributes.
- findWalk directory trees and select entries using tests and actions.
- Get-ChildItemEnumerate items and child items in filesystem, registry, and other providers.
FAQ
What does Copy-Item do in PowerShell?
Copy items between locations supported by PowerShell providers.
How can I see examples for Copy-Item?
Run `Get-Help Copy-Item -Examples`, then adapt an example to the provider and objects you are using.
What is a practical Copy-Item example?
Try `Copy-Item .\report.txt D:\Archive\` — Copies the report into Archive.
Does Copy-Item return text or objects?
Copy-Item normally participates in PowerShell's object pipeline; formatting seen in the console is a view of those objects.
Browse the full Linux and Windows command reference to search more bash, CMD, PowerShell, Conda, and GitHub CLI commands.