Command: copy

  Copies one or more source files to another location


  1. COPY [{ option }] source [{ option }] target [{ option }]
  2. COPY [/A | /B] [drive][path]filename + [/A | /B] [drive]
     [path]filename [+ [...]] [/A | /B] [/V] [/Y | /-Y] [/?]
     source:   The source file. If more than one source file is
               specified, the target must be a directory.
     target:   The target of the COPY process. If target is a directory,
               the destination file is placed into this directory, but
               with the same filename as the source file.
               If exactly one source is specified, but no target, target
               defaults to just ., which represant the current directory.
     drive     The drive letter, e.g. C:
     path      The directory, e.g. \example\
     filename  The file name, e.g. test.txt


  Unless stated otherwise all options of this command do follow the
  standard rules for options.
    /A  Forces ASCII mode, see below
    /B: Specifies the mode, in which the file is copied, /A forces ASCII
        and /B forces binary mode.
        These options do alter the mode of the file immediately
        preceeding them and all following ones, until changed again.
        In binary mode the file is copied and nothing is changed at all.
        In ASCII mode COPY takes special care about linefeeds / newline
        characters and the end-of-line character.
        On read, the newline characters, which are a sequence of two
        different bytes in DOS, are transformed into a single character,
        as known from Unix-style systems. On write, this single character
        is transformed into the two-byte sequence.
        So, if both files are copied with different modes, newline
        characters are transformed into either way.
        If the end-of-file character is found on read, the remaining
        contents of the file is ignored. On write, such character is
        appended after the last character has been written. By default,
        files are copied in binary mode, whereas devices, e.g.
        CON:, are copied in ASCII mode, but no end-of-file is appended.
    /V  Verifies that new files are written correctly.
    /Y  Suppresses prompting to confirm you want to overwrite an
        existing destination file.
    /-Y Causes prompting to confirm you want to overwrite an existing
        destination file.
    /?  Shows the help.


  COPY won't copy directories or files that are of zero length.
  To copy either of these, use XCOPY.
  Before parsing its command line COPY parses any option specified by
  The COPYCMD ENVIRONMENT VARIABLE can be set to make /Y the default:
  To cancel the /Y for a particular copy command, use /-Y at the command
  line. The COPYCMD variable also affects the XCOPY command.
  To append files (second variant), specify a single file for
  destination, but multiple files for source (using wildcards or
  file1+file2+file3 format).
  COPY is a command internal to and needs no other file
  in order to work.


  copy c:\ a:         (first variant)
  copy c:\*.exe d:\example       (first variant)
  copy c:\FREEDOS\BIN\*.* a:\    (first variant)
  copy c:\FREEDOS\BIN\edit.* a:  (first variant)
  copy /A hello.txt + /A welcome.txt + /A great.txt /A together.txt
  (second variant, together.txt contains everything).

See also:
  environment variable

  Copyright © 2004 Robert Platt, updated 2011 and 2022 by W. Spiegl.

  This file is derived from the FreeDOS Spec Command HOWTO.
  See the file H2Cpying for copying conditions.