Copy'em Paste 2.4.0

Copy one or more files to another location.

The copy command is used for complete files, if you want to copy a directory, or multiple directories containing files, use the robocopy or xcopy command. If you want to copy text within a file, see: How to copy and paste text in a document or another program.

Combining files

Oct 16, 2017 Remarks. You can copy an ASCII text file that uses an end-of-file character (CTRL+Z) to indicate the end of the file. When /a precedes or follows a list of files on the command line, it applies to all files listed until copy encounters /b. ROBOCOPY - Robust File and Folder Copy. XCOPY - Copy files and folders. MOVE - Move a file from one folder to another. Q126457 - VERIFY ON, COPY /V, XCOPY /V commands do not compare data. PowerShell equivalent: Copy-Item - Copy an item from one location to another. Equivalent bash command (Linux): cp - Copy one or more files to another location. 28 synonyms of copy from the Merriam-Webster Thesaurus, plus 49 related words, definitions, and antonyms. Find another word for copy. Copy has been discontinued. Copy was discontinued on May 1, 2016. Copy and paste every emoji with đź‘Ť no apps required.

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. Publisher lab 4.4.4.

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:
SET COPYCMD=/Y

Errorlevels

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

COPY will accept UNC pathnames

Examples:
Copy a file in the current folder
COPY source_file.doc newfile.doc
Copy from a different folder/directory:
COPY 'C:my worksome file.doc' 'D:New docsnewfile.doc'
Specify the source only, with a wildcard will copy all the files into the current directory:
COPY 'C:my work*.doc'
Specify the source with a wildcard and the destination as a single file, this is generally only useful with plain text files.
COPY 'C:my work*.txt' 'D:New docscombined.txt'
Quiet copy (no feedback on screen)
COPY source_file.doc newfile.doc >nul

Copy a file, but do not overwrite if the destination file already exists, this technique only works for a single file, no wildcards:

Echo n COPY /-y c:demosource_file.txt c:dirdest.txt

COPY is an internal command.
“Success seems to be connected with action. Successful men keep moving. They make mistakes, but they don’t quit” ~ Conrad Hilton

Related:
ROBOCOPY - Robust File and Folder Copy.
XCOPY - Copy files and folders.
MOVE - Move a file from one folder to another.
Q126457 - VERIFY ON, COPY /V, XCOPY /V commands do not compare data.
PowerShell equivalent: Copy-Item - Copy an item from one location to another.
Equivalent bash command (Linux): cp - Copy one or more files to another location.

Copyright © SS64.com 1999-2020
Some rights reserved

The copy command allows users to copy one or more files to an alternate location.

Note

The copy command is used for complete files, if you want to copy a directory, or multiple directories containing files, use the robocopy or xcopy command. If you want to copy text within a file, see: How to copy and paste text in a document or another program.

Availability

Copy is an internal command and is available for the following Microsoft operating systems.

Copy syntax

Windows Vista and later syntax

COPY [/D] [/V] [/N] [/Y /-Y] [/Z] [/L] [/A /B ] source [/A /B] [+ source [/A /B] [+ ..]] [destination [/A /B]]

sourceSpecifies the file or files to be copied.
/AIndicates an ASCII text file.
/BIndicates a binary file.
/D Allow the destination file to be created decrypted.
destinationSpecifies the directory or file name for the new file(s).
/VVerifies that new files are written correctly.
/NUses short file name, if available, when copying a file with a non-8dot3 name.
/YSuppresses prompting to confirm you want to overwrite an existing destination file.
/-YCauses prompting to confirm you want to overwrite an existing destination file.
/ZCopies networked files in restartable mode.
/LIf the source is a symbolic link, copy the link to the target instead of the actual file the source link points to.

Copy And Paste Symbols

The switch /Y may be preset in the COPYCMD environment variable. This setting may be overridden with /-Y on the command line. The default is to prompt on overwrites unless 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 wildcards or file1+file2+file3 format).

Windows XP and earlier syntax

Copy Of Birth Certificate

COPY [/A /B] source [/A /B] [+ source [/A /B] [+ ..]] [destination] [/A /B]] [/V] [/Y /-Y]

sourceSpecifies the file or files to be copied.
/AIndicates an ASCII text file.
/BIndicates a binary file.
destinationSpecifies the directory or file name for the new file(s).
/VVerifies that new files are written correctly.
/YSuppresses prompting to confirm you want to overwrite an existing destination file.
/-YCauses prompting to confirm you want to overwrite an existing destination file.

The switch /Y may be preset in the COPYCMD environment variable. This setting may be overridden with /-Y on the command line.

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

Copy examples

In the example above, we are using a wildcard to copy all .txt files (multiple files) from the current directory to the c: root directory.

Copy all files in the current directory to the floppy disk drive.

Note

If there are hidden files, they're not copied. To copy all files including hidden files, use the xcopy command.

Copy the autoexec.bat, usually found at root, and copy it into the Windows directory; the autoexec.bat can be substituted for any file(s).

Copy the win.ini file in the current directory to the Windows directory. Because this file already exists in the Windows directory it normally would prompt if you want to overwrite the file. However, with the /y switch you will not receive any prompt.

Copy the file 'computer hope.txt' into the hope directory. Whenever you are dealing with a file or directory with a space, it must be surrounded with quotes. Otherwise, you'll get the 'Getting 'The syntax of the command is incorrect.' error.' error.

Copy Games

Copy the contents in myfile2.txt and combines it with the contents in myfile1.txt.

Finally, a user can create a file using the copy con command as shown above, which creates the test.txt file. Once the above command is typed in, a user could type in whatever he or she wishes. When you have completed creating the file, you can save and exit the file by pressing Ctrl+Z, which would create ^Z, and then press Enter. An easier way to view and edit files in MS-DOS would be to use the edit command.

Additional information

Copypress

  • See our copy definition for further information and related links on this term.