XCOPY explained

XCOPY should not be confused with XCOPY (artist).

Developer:Microsoft, IBM, DR, Datalight, Novell, Rene Ableidinger, ReactOS Contributors
Operating System:MS-DOS, PC DOS, MSX-DOS, SISNE plus, OS/2, eComStation, ArcaOS, Windows, DR DOS, ROM-DOS, FreeDOS, ReactOS
Genre:Command
License:FreeDOS: GPL
ReactOS: LGPL
Others: Proprietary

In computing, XCOPY is a command used on IBM PC DOS, MS-DOS, IBM OS/2,[1] Microsoft Windows,[2] FreeDOS,[3] ReactOS,[4] and related operating systems for copying multiple files or entire directory trees from one directory to another and for copying files across a network.

Overview

XCOPY stands for extended copy,[5] and was created as a more functional file copying utility than the [[copy (command)|copy]] command found in earlier operating systems. XCOPY first appeared in DOS 3.2.[6]

While still included in Windows 10, XCOPY has been deprecated in favor of [[robocopy]], a more powerful copy tool, which is now supplied with the Microsoft Windows Server and Desktop operating systems.[7]

DR DOS 6.0[8] and Datalight ROM-DOS[9] include an implementation of the command.

The FreeDOS version was developed by Rene Ableidinger and is licensed under the GPL.[10]

J. Edmeades developed the Wine-compatible version that is included in ReactOS. It is licensed under the LGPL.[11]

Compression

Since Windows Server 2019 and Windows 10, a compression option is available in xcopy when copying across a network. With this switch, if the destination computer supports SMB compression and the files being copied are very compressible, there may be significant improvements to performance. The SMB compression adds inline whitespace compression to file transfers. Compression is also available with the [[robocopy]] command and Hyper-V Live Migration with SMB.[12] [13]

Example

Create a new directory by copying all contents of the existing directory, including any files or subdirectories having the hidden or system attributes and empty directories.

>xcopy e:\existing e:\newcopy /e /i /h

If the pathnames include spaces, they must be enclosed in quotation marks.

>xcopy "D:\Documents and Settings\MY.USERNAME\My Documents\*" "E:\MYBACKUP\My Documents\" /D/E/C/Y

Copy entire drive in to a mapped network drive while ignoring any errors in network restartable mode.

>xcopy *.* z:\Netmirror /E /V /C /F /H /Y /Z 1>out.txt 2>err.txt

Copy a single file without prompt if it is a file or a directory

>cmd /c echo F | xcopy "c:\directory 1\myfile" "c:\directory 2\myfile"

Limitations

XCOPY fails with an "insufficient memory" error when the path plus filename is longer than 254 characters.[14] An option "/J" copies files without buffering;[15] moving very large files without the option (available only after Server 2008R2) can consume all available RAM on a system.

No open files

XCOPY will not copy open files. Any process may open files for exclusive read access by withholding the FILE_SHARE_READ[16]

XCOPY does not support the Windows Volume Shadow Copy service which effectively allows processes to have access to open files, so it is not useful for backing up live operating system volumes.

XCOPY deployment

XCOPY deployment or xcopy installation is a software application's installation into a Microsoft Windows system simply by copying files. The name is derived from the XCOPY command line facility provided by Microsoft operating systems.

In contrast, the installation of a typical Windows application will require a significant number of additional steps before the application is ready to be used. Most of this additional work involves, directly or indirectly, adding or modifying entries in the Windows Registry. Even when an application uses ordinary files for its own data, many common facilities provided by Windows require some type of registration step before they are available to programs. Usually, one or more specialized tools (such as Windows Installer, InnoSetup, or NSIS) are used to help coordinate these relatively complex operations.

See also

Further reading

External links

Notes and References

  1. Web site: JaTomes Help - OS/2 Commands . www.jatomes.com . dead . https://web.archive.org/web/20190414130029/http://www.jatomes.com/Help/Os2Cmd.php . 2019-04-14.
  2. https://technet.microsoft.com/en-us/library/cc771254.aspx Xcopy
  3. Web site: The FreeDOS Project blog: FreeDOS commands quick-reference . freedos-project.blogspot.com . dead . https://web.archive.org/web/20180722155725/http://freedos-project.blogspot.com/2018/06/freedos-commands-quick-reference.html . 2018-07-22.
  4. Web site: Reactos/Base/Applications/Cmdutils/Xcopy at master ยท reactos/Reactos. GitHub.
  5. Web site: Windows NT File System Files . 2006-11-01 . Microsoft Help and Support . Microsoft.
  6. Book: Wolverton. Van. Running MS-DOS Version 6.22 (20th Anniversary Edition), 6th Revised edition. 2003. Microsoft Press. 0-7356-1812-7.
  7. Web site: Robocopy built into Vista . Pietrek . Matt . Matt Pietrek . 2007-01-16 . Under The Hood (an MSDN blog).
  8. https://www.4corn.co.uk/archive/docs/DR%20DOS%206.0%20User%20Guide-opt.pdf DR DOS 6.0 User Guide Optimisation and Configuration Tips
  9. Web site: Datalight ROM-DOS User's Guide. www.datalight.com.
  10. Web site: FreeDOS 1.2 Updates Package - XCopy (FreeDOS Base) . Ibiblio.org . 2007-09-22 . 2022-09-08.
  11. Web site: Reactos/Reactos. GitHub. 26 November 2021.
  12. Web site: SMB Compression Lowers Bandwidth and Improves Copy Times in Windows Server and Azure. Smith . Russell . Petri . 27 November 2020 .
  13. Output from xcopy /? in Windows 10 includes "/COMPRESS - Request network compression during file transfer where applicable".
  14. Web site: Xcopy: Insufficient Memory. Maciak . Luke . Luke Maciak . 2007-02-05.
  15. Web site: Technet: Xcopy . 2019-05-01.
  16. https://msdn.microsoft.com/en-us/library/aa363858.aspx CreateFileA function (fileapi.h)