Skip to main content

Command referencecopy

copy command (Windows / CMD)

WindowsCMDfilebeginner

What it does

Copy one or more files and optionally combine text or binary files. Searches for the copy command cmd usually need CMD syntax, practical switches, and notes on how it compares with PowerShell or Linux alternatives. This page covers syntax, common options, and copyable examples for Command Prompt.

Copy one or more files and optionally combine text or binary files.

Syntax

copy [/D] [/V] [/N] [/Y | /-Y] source [destination]

Common options

Flag / optionMeaning
/YSuppress overwrite confirmation.
/-YPrompt before replacing a destination.
/VVerify that new files can be read.
/BTreat the selected file as binary.

Practical examples

Copy file

copy report.txt D:\Archive\

Copies a file into Archive.

Confirm overwrite

copy /-Y config.ini config.bak

Prompts if config.bak exists.

Combine text

copy /A part1.txt+part2.txt complete.txt

Concatenates two text files.

Linux ↔ Windows equivalent

Closest match: cp (Linux / bash / sh / zsh). Copy files or directory trees to another location.

Common mistakes

  • Using copy for directory trees; use xcopy or robocopy.
  • Reversing source and destination and replacing the wrong file.

FAQ

What does copy do in Command Prompt?

Copy one or more files and optionally combine text or binary files.

How do I run copy in CMD?

Open Command Prompt and follow `copy [/D] [/V] [/N] [/Y | /-Y] source [destination]`; quote paths containing spaces.

What is a practical copy example in CMD?

Try `copy report.txt D:\Archive\` — Copies a file into Archive.

Can copy be used in a batch file?

Yes. Check its exit code and escape CMD metacharacters when input is variable.

Browse the full Linux and Windows command reference to search more bash, CMD, PowerShell, Conda, and GitHub CLI commands.