COPY – Windows CMD Command

Copy one or more files to another location.

Combining files

To combine files, specify a single file for the destination, but multiple files as the source. To specify more than one file use wildcards or list the files with a + in between each (file1+file2+file3)
When copying multiple files in this way the first file must exist or else the copy will fail, a workaround for this is COPY null + file1 + file2 dest1

Binary copies

“COPY /B … ” will copy files in binary mode.

The /A and /B options can appear in multiple locations, with different meanings depending on location.
Before any source – they will set the default mode for all source and destination files.
After a source – they will set the mode for that source.
After the destination – they will set the mode for the destination.

Copy from the console (accept user input)

COPY CON filename.txt
Then type the input text followed by ^Z (Control key & Z)

Prompt to overwrite destination file

Under Windows 2000 and above, the default action is to prompt on overwrite unless the command is being executed from within a batch script.
To force the overwriting of destination files use the COPYCMD environment variable:


If the file(s) were successfully copied %ERRORLEVEL% = 0
If the file was not found or bad parameters are given = 1

COPY will accept UNC pathnames

COPY is an internal command.

You may also like...

1 Response

  1. froleprotrem says:

    There is visibly a bundle to realize about this. I consider you made certain nice points in features also.

Leave a Reply

Your email address will not be published. Required fields are marked *