copy is a shell command for copying files.

Different implementations provide various capabilities, such as:

  • Combining (concatenating) multiple files into a single file
  • If multiple source files are specified before the path to an existing directory, then files are copied to the directory
  • Support for text vs. binary data; for text, the command stops when it reaches an end-of-file (EOF) character; for binary, files are copied in their entirety, ignoring EOF
  • In DOS, a file can be copied to or from a device. For example, copy path con outputs the file at path to the console, and copy con path copies text typed at the console to a file at path

Implementations

The command is available in RT-11, OS/8, RSX-11, ISIS-II, iRMX 86, TOPS-10, TOPS-20, OpenVMS, MetaComCo TRIPOS, HDOS, Z80-RIO, OS-9, DOS, FlexOS, 4690 OS, PC-MOS, HP MPE/iX, OS/2, Windows, ROM-DOS, ReactOS, SymbOS, DexOS, and 86-DOS.

Under IBM PC DOS/MS-DOS the command is available since version 1.

Some shells provide a copy command with a different name. In Unix-based systems, the copy command is cp. In CP/M, the command is PIP. in OpenVOS, the command is copy_file.

DOS

The following copies existing file fromfile to path tofile.

A file can be copied to a device. The following sends a file to the printer on lpt1.

The following outputs to stdout, like the type command.

The following concatenates the page# files into book.txt – like cat.

The command can copy files between drives.

The following uses text mode to copy text of the file, stopping when it reaches an EOF character.

The following uses binary mode, concatenating files in their entirety and ignoring EOF characters.

See also

  • XCOPY – Shell command for copying files

Further reading

  • Wolverton, Van (1990). MS-DOS Commands: Microsoft Quick Reference, 4th Revised edition. Microsoft Press. ISBN 978-1556152894.
  • Kathy Ivens; Brian Proffit (1993). OS/2 Inside & Out. Osborne McGraw-Hill. ISBN 978-0078818714.
  • Frisch, Æleen (2001). Windows 2000 Commands Pocket Reference. O'Reilly. ISBN 978-0-596-00148-3.

External links