You are currently offline, waiting for your internet to reconnect

COPY Concatenates Files Based on Command Syntax

This article was previously published under Q69575
Retired KB Content Disclaimer
This article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.
The MS-DOS COPY command can combine multiple files into one file. When youissue a command of the following form, COPY switches to ASCII mode andmerges all source files into the target file
COPY <multiple_file_list> <single_file>
where <multiple_file_list> can be of three forms: filenames with "*" or "?"(wildcard filenames), filenames separated with "+" (a specific, orderedlist of files), or a combination of the two.

Because the COPY command recognizes <single_file> as being an absolutetarget, it assumes that you want to concatenate the multiple files into asingle new file. This means that COPY switches to ASCII mode where end-of-file (EOF) markers are acknowledged.
This behavior is sometimes confusing when you know that only one fileexists that matches the source filename and you formulate a COPY commandthat assumes that knowledge. If you issue a command as in the followingexample, COPY still switches into merge mode and copies the file as if itwere ASCII:
Although you intended to copy only COMMAND.COM from the root of drive C tothe root of drive A, COPY actually tries to concatenate COMMAND.COM withsome other file before it discovers that the some other file does notexist. The resulting file is shorter than the original because COPY stoppedat the first 0x01A byte that it found. (In the case of COMMAND.COM, this isusually within the first ten characters, so this particular example occursquite often).
6.22 3.20 3.21 3.30 3.30a 4.00 4.01 5.00 5.00a 6.00 6.20 truncate

Article ID: 69575 - Last Review: 05/12/2003 21:22:20 - Revision: 2.0

  • Microsoft MS-DOS 3.1
  • Microsoft MS-DOS 3.2 Standard Edition
  • Microsoft MS-DOS 3.21 Standard Edition
  • Microsoft MS-DOS 3.3 Standard Edition
  • Microsoft MS-DOS 3.3a
  • Microsoft MS-DOS 4.0 Standard Edition
  • Microsoft MS-DOS 4.01 Standard Edition
  • Microsoft MS-DOS 5.0 Standard Edition
  • Microsoft MS-DOS 5.0a
  • Microsoft MS-DOS 6.0 Standard Edition
  • Microsoft MS-DOS 6.2 Standard Edition
  • Microsoft MS-DOS 6.21 Standard Edition
  • Microsoft MS-DOS 6.22 Standard Edition
  • KB69575