COPY
Copy one or more files to another location. If you are looking for more functionality, you may find the XCOPYXCOPY and ROBOCOPYROBOCOPY commands useful.
COPY [/D] [/V] [/N] [/Y] [/-Y] [/Z] [/A | /B] source [/A | /B] [+ source [/A | /B] [+ ...]] [destination [/A | /B]]
Where:
source- Indicates the files to copy./A- Indicates an ASCII text file./B- Indicates a binary file./D- Allows the target file to be created as decrypted.destination- Specify the directory and/or name of the new files./V- Verifies that the new files have been copied correctly./N- Use shortened file names, if available, when copying files with long names./Y- Does not ask for confirmation before overwriting an existing destination file./-Y- Prompts for confirmation before overwriting an existing destination file./Z- Copy files from the network in restartable mode.
It is possible to concatenate multiple files into a single file by specifying the + symbol before each additional source file (see examples below).
If the /Y option is run with the /-Y option, you will be prompted before overwriting an existing destination file. If both the /Y option and the /-Y option are omitted, you will be prompted unless the COPY command is run from a batch scriptbatch script.
Setting the COPYCMD environment variable allows you to specify /Y as the default option, which can be deactivated using /-Y, see XCOPYXCOPY.
Using the following syntax, you copy what is typed at the command prompt into the specified file:
COPY [/D] [/V] [/N] [/Y] [/-Y] [/Z] [/A | /B] CON destination [/A | /B]
To exit this mode, deleting the target file, type ^C (Ctrl + C). If you do not want to delete the file, close the command prompt.
Examples:
1. Copy the contents of the file C:\GWAHAHAHA.txt to the new path C:\a.txt:
copy "C:\GWAHAHAHA.txt" "C:\a.txt"
2. Copy the contents of the C:\Start.txt, C:\Center.txt, and C:\End.txt files to the C:\All.txt file:
copy "C:\Start.txt"+"C:\Center.txt"+"C:\End.txt" "C:\All.txt"
3. Copy what is written in the command prompt to the file C:\out.txt from the moment the command is started:
copy con "C:\out.txt"
Comments