To copy a file called Memo.doc to Letter.doc in the current drive and ensure that an end-of-file character (CTRL+Z) is at the end of the copied file, type:
copy memo.doc letter.doc /a
To copy a file named Robin.typ from the current drive and directory to an existing directory named Birds that is located on drive C, type:
copy robin.typ c:\birds
If the Birds directory does not exist, the file Robin.typ is copied into a file named Birds that is located in the root directory on the disk in drive C.
To copy several files into one file, list several Source files, separate the file names with a plus sign (+), and specify a Destination file that you want to contain the resulting combined file. For example, to combine Mar89.rpt, Apr89.rpt, and May89.rpt, which are located on the current drive and directory, and place them in a file named Report on the current drive and directory, type:
copy mar89.rpt + apr89.rpt + may89.rpt report
When you combine files, copy marks the destination file with the current date and time. If you omit Destination, the files are combined and stored under the name of the file specified first. For example, to combine all four files in Report when a file named Report already exists, type:
copy report + mar89.rpt + apr89.rpt + may89.rpt
You can also combine several files into one file by using wildcard characters (that is, * or ?). For example, to combine all files in the current directory on the current drive that have the extension .txt into one file named Combin.doc, type:
copy *.txt combin.doc
If you want to combine several binary files into one file by using wildcard characters, include /b. This prevents Windows XP from treating CTRL+Z as an end-of-file character. For example, type:
copy /b *.exe combin.exe
Caution
-
If you combine binary files, the resulting file might be unusable due to internal formatting.
In the following example, copy combines each file that has a .txt extension with its corresponding .ref file. The result is a file with the same file name but with a .doc extension. Copy combines File1.txt with File1.ref to form File1.doc, and then copy combines File2.txt with File2.ref to form File2.doc, and so on. For example, type:
copy *.txt + *.ref *.doc
To combine all files with the .txt extension, and then combine all files with the .ref extension into one file named Combin.doc, type:
copy *.txt + *.ref combin.doc