Quincy Center for Technical Education
Computer Technology Department

Copy

Copies one or more files to another location.

This command can also be used to combine files. When more than one file is copied, Windows 2000 displays each file name as the file is copied.

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

Parameters

source

Specifies the location and name of a file or set of files from which you want to copy. Source can consist of a drive letter and colon, a folder name, a file name, or a combination.

destination

Specifies the location and name of a file or set of files to which you want to copy. Destination can consist of a drive letter and colon, a folder name, a file name, or a combination.

/a

Indicates an ASCII text file. When the /a switch precedes the list of file names on the command line, it applies to all files whose names follow the /a switch, until copy encounters a /b switch. In this case, the /b switch applies to the file whose name precedes the /b switch.

When the /a switch follows a file name, it applies to the file whose name precedes the /a switch and to all files whose names follow the /a switch, until copy encounters a /b switch. In this case the /b switch applies to the file whose name precedes the /b switch. An ASCII text file can use an end-of-file character (CTRL+Z) to indicate the end of the file. When combining files, copy treats files as ASCII text files by default.

/b

Indicates a binary file. When the /b switch precedes the list of file names on the command line, it applies to all files whose names follow the /b switch, until copy encounters an /a switch. In this case, the /a switch applies to the file whose name precedes the /a switch.

When the /b switch follows a file name, it applies to the file whose name precedes the /b switch and to all files whose names follow the /b switch, until copy encounters an /a switch. In this case, the /a switch applies to the file whose name precedes the /a switch.

The /b switch specifies that the command interpreter is to read the number of bytes specified by the file size in the directory. The /b switch is the default value for copy unless copy is combining files.

/v

Verifies that new files are written correctly.

/n

Uses a short file name, if available, when copying a file with a name longer than eight characters, or with a file extension longer than three characters.

/y

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

The /y switch may be preset in the COPYCMD environment variable. You can override this setting by using /-y on the command line. The default is to prompt when replacing unless the copy command is being executed from within a batch script.

To append files, specify a single file for destination, but multiple files for source (using wildcard characters or file1+file2+file3 format).

/-y

Causes prompting to confirm you want to overwrite an existing destination file.

/z

Copies networked files in restartable mode. If the connection is lost during the copy phase (for example, if the server going offline severs the connection), it will resume after the connection has been re-established. Using this command switch also displays the percentage of the copy operation completed for each file.

For more information about the xcopy command, click xcopy in the Related Topics list.