Copy--Examples
The following command copies a file and ensures that an end-of-file character
is at the end of the copied file:
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 the following
command:
copy robin.typ c:\birds
If the BIRDS directory doesn't exist, Windows NT copies the file ROBIN.TYP
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 any number of files as source parameters on the copy command line. Separate filenames with a plus sign (+) and specify a filename
for the resulting combined file, as the following example shows:
copy mar89.rpt + apr89.rpt + may89.rpt report
This command combines the files named MAR89.RPT, APR89.RPT, and MAY89.RPT from
the current drive and directory and places them in a file named REPORT in the
current directory on the current drive. When files are combined, the
destination file is created with the current date and time. If you omit destination, Windows NT combines the files and stores them under the name of the first
specified file. For example, if a file named REPORT already exists, you can use
the following command to combine all four files in REPORT:
copy report + mar89.rpt + apr89.rpt + may89.rpt
You can also combine several files into one by using wildcards, as the
following example shows:
copy *.txt combin.doc
This command combines all files in the current directory on the current drive
that have the extension .TXT into one file named COMBIN.DOC, also in the
current directory on the current drive.
If you want to combine several binary files into one by using wildcards,
include the /b switch, as the following example shows:
copy /b *.exe combin.exe
This prevents Windows NT from treating CTRL+Z as an end-of-file character.
Caution
If you combine binary files, the resulting file might not be usable 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 filename but with a .DOC extension. Thus, copy combines FILE1.TXT with FILE1.REF to form FILE1.DOC. Then copy combines FILE2.TXT with FILE2.REF to form FILE2.DOC, and so on.
copy *.txt + *.ref *.doc
The following copy command combines first all files with the .TXT extension, then all files with
the .REF extension into one file named COMBIN.DOC:
copy *.txt + *.ref combin.doc
More Information About Copy
Copy--Notes
Copy