Command: copy

  Copies one or more source files to another location

Syntax:

  1. COPY [{ option }] source [{ option }] target [{ option }]
  2. COPY [/A | /B] [drive][path]filename + [/A | /B] [drive]
     [path]filename [+ [...]] [/A | /B] [/V] [/Y | /-Y] [/?]
     [drive][path]filename
     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

Options:

  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.

Comments:

  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 ENVIRONMENT VARIABLE COPYCMD.
  The COPYCMD ENVIRONMENT VARIABLE can be set to make /Y the default:
    SET COPYCMD=/Y
  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 command.com and needs no other file
  in order to work.

Examples:

  copy c:\command.com 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:

  command.com/freecom
  del/erase
  diskcopy
  environment variable
  move
  ren/rename
  set
  verify
  xcopy

  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.