XCOPY

Last updated
Developer(s) Microsoft, IBM, DR, Datalight, Novell, Rene Ableidinger, ReactOS Contributors
Initial release1986, 3637 years ago
Operating system MS-DOS, PC DOS, MSX-DOS, SISNE plus, OS/2, eComStation, ArcaOS, Windows, DR DOS, ROM-DOS, FreeDOS, ReactOS
Type Command
License FreeDOS: GPL
ReactOS: LGPL
Others: Proprietary
Website docs.microsoft.com/en-us/windows-server/administration/windows-commands/xcopy   OOjs UI icon edit-ltr-progressive.svg

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.

Contents

Overview

XCOPY stands for extended copy, [5] and was created as a more functional file copying utility than the 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 XCOPY 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

Related Research Articles

dir (command) Directory information command on various operating systems

In computing, dir (directory) is a command in various computer operating systems used for computer file and directory listing. It is one of the basic commands to help navigate the file system. The command is usually implemented as an internal command in the command-line interpreter (shell). On some systems, a more graphical representation of the directory structure can be displayed using the tree command.

mkdir Directory creation command on various operating systems

The mkdir command in the Unix, DOS, DR FlexOS, IBM OS/2, Microsoft Windows, and ReactOS operating systems is used to make a new directory. It is also available in the EFI shell and in the PHP scripting language. In DOS, OS/2, Windows and ReactOS, the command is often abbreviated to md.

<span class="mw-page-title-main">ReactOS</span> Free incomplete Windows NT-like operating system

ReactOS is a free and open-source operating system for amd64/i686 personal computers intended to be binary-compatible with computer programs and device drivers developed for Windows Server 2003 and later versions of Microsoft Windows. ReactOS has been noted as a potential open-source drop-in replacement for Windows and for its information on undocumented Windows APIs.

In computing, rmdir is a command which will remove an empty directory on various operating systems.

<span class="mw-page-title-main">CHKDSK</span> System tool in DOS, OS/2 and Windows

In computing, CHKDSK is a system tool and command in DOS, Digital Research FlexOS, IBM/Toshiba 4690 OS, IBM OS/2, Microsoft Windows and related operating systems. It verifies the file system integrity of a volume and attempts to fix logical file system errors. It is similar to the fsck command in Unix and similar to Microsoft ScanDisk, which co-existed with CHKDSK in Windows 9x and MS-DOS 6.x.

In computing, SUBST is a command on the DOS, IBM OS/2, Microsoft Windows and ReactOS operating systems used for substituting paths on physical and logical drives as virtual drives.

Robocopy is a command-line file transfer utility for Microsoft Windows. Robocopy is functionally more comprehensive than the COPY command and XCOPY, but replaces neither. Created by Kevin Allen and first released as part of the Windows NT 4.0 Resource Kit, it has been a standard feature of Windows since Windows Vista and Windows Server 2008.

The NTFS file system defines various ways to redirect files and folders, e.g., to make a file point to another file or its contents without making a copy of it. The object being pointed to is called the target. Such file is called a hard or symbolic link depending on a way it's stored on the filesystem.

<span class="mw-page-title-main">ATTRIB</span>

In computing, ATTRIB is a command in Intel ISIS-II, DOS, IBM OS/2, Microsoft Windows and ReactOS that allows the user to change various characteristics, or "attributes" of a computer file or directory. The command is also available in the EFI shell.

ren (command)

In computing, ren is a command in various command-line interpreters (shells) such as COMMAND.COM, cmd.exe, 4DOS, 4NT and Windows PowerShell. It is used to rename computer files and in some implementations also directories. It is analogous to the Unix mv command. However, unlike mv, ren cannot be used to move files, as a new directory for the destination file may not be used. Alternatively, move may be used if available. On versions of MS-DOS that do not support the move command, the user would simply copy the file to a new destination, and then delete the original file. A notable exception to this rule is DOSBox, in which ren may be used to move a file, since move is not supported.

del (command) Command in various operating systems

In computing, del is a command in command-line interpreters (shells) such as COMMAND.COM, cmd.exe, 4DOS, NDOS, 4OS2, 4NT and Windows PowerShell. It is used to delete one or more files or directories from a file system.

help (command) Command in various command line shells

In computing, help is a command in various command line shells such as COMMAND.COM, cmd.exe, Bash, qshell, 4DOS/4NT, Windows PowerShell, Singularity shell, Python, MATLAB and GNU Octave. It provides online information about available commands and the shell environment.

copy (command)

In computing, copy is a command in various operating systems. The command copies computer files from one directory to another.

format (command)

In computing, format, a command-line utility that carries out disk formatting. It is a component of various operating systems, including 86-DOS, MS-DOS, IBM PC DOS and OS/2, Microsoft Windows and ReactOS.

choice (command)

In computing, choice is a command that allows for batch files to prompt the user to select one item from a set of single-character choices. It is available in a number of operating system command-line shells.

title (command) Command of command line interpreters

In computing, title is a command in various command-line interpreters (shells) on Microsoft Windows and ReactOS that changes the title for the graphical terminal emulator window. The command is also used within DFS and ADFS to change the title of the disc in the current drive.

diskpart Command line program

In computing, diskpart is a command-line disk partitioning utility included in Windows 2000 and later Microsoft operating systems, replacing its predecessor, fdisk. The command is also available in ReactOS.

net (command)

In computing, net is a command in IBM OS/2, Microsoft Windows, ReactOS and Greentea OS used to manage and configure the operating system from the command-line. It is also part of the IBM PC Network Program for DOS.

In computing, diskcopy is a command used on a number of operating systems for copying the complete contents of a diskette to another diskette.

References

  1. "JaTomes Help - OS/2 Commands". www.jatomes.com. Archived from the original on 2019-04-14.
  2. Xcopy
  3. "The FreeDOS Project blog: FreeDOS commands quick-reference". freedos-project.blogspot.com. Archived from the original on 2018-07-22.
  4. "Reactos/Base/Applications/Cmdutils/Xcopy at master · reactos/Reactos". GitHub .
  5. "Windows NT File System Files". Microsoft Help and Support. Microsoft. 2006-11-01.
  6. Wolverton, Van (2003). Running MS-DOS Version 6.22 (20th Anniversary Edition), 6th Revised edition. Microsoft Press. ISBN   0-7356-1812-7.
  7. Pietrek, Matt (2007-01-16). "Robocopy built into Vista". Under The Hood (an MSDN blog).
  8. DR DOS 6.0 User Guide Optimisation and Configuration Tips
  9. "Datalight ROM-DOS User's Guide" (PDF). www.datalight.com.
  10. "FreeDOS 1.2 Updates Package - XCopy (FreeDOS Base)". Ibiblio.org. 2007-09-22. Retrieved 2022-09-08.
  11. "Reactos/Reactos". GitHub . 26 November 2021.
  12. Smith, Russell (27 November 2020). "SMB Compression Lowers Bandwidth and Improves Copy Times in Windows Server and Azure". Petri.
  13. Output from xcopy /? in Windows 10 includes "/COMPRESS - Request network compression during file transfer where applicable".
  14. Maciak, Luke (2007-02-05). "Xcopy: Insufficient Memory".
  15. "Technet: Xcopy". 2019-05-01.
  16. CreateFileA function (fileapi.h)

Further reading