Name

copy

Synopsis

Copy one or more files to another location.

Syntax

copy source 
                        destination

copy [/a | /b] source [/a | /b] [+ source [/a | /b] 
[+ ...]] [destination [/a | /b]] [/v] [/y | /-y] 
[/d] [/z]

Description

copy makes a complete copy of an existing file. If another file by the same name exists at destination, you will be asked if you want to overwrite it.

Omit the destination to copy the specified files to the current working directory. If the file (or files) to be copied is in a different directory or on a different disk, you can omit the destination filename. The resulting copy or copies will have the same name as the original.

You can use the special device name con (or con:) in place of either the source or destination filename to copy from the keyboard to a file (or from a file to the screen).

copy accepts the following parameters and options:

/a

Specifies that the file to copy is in ASCII format

/b

Specifies that the file to copy is a binary file

/v

Verifies that new files are written successfully by comparing them with the originals

/y

Suppresses prompting to confirm you want to overwrite an existing destination file

/-y

Enables prompting to confirm you want to overwrite an existing destination file with the same name (default)

/d

Allow the new file to be decrypted (NTFS volumes only)

/z

Copies networked files in restartable mode

Examples

Copy the file temp.txt from C:\ to d:\files (all three examples do the same thing):

C:\>copy c:\temp.txt d:\files\temp.txt
C:\>copy ...

Get Windows XP in a Nutshell, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.