Jump to content

XCOPY

From Alfawiki
Adapted from the English Wikipedia article XCOPY, available under CC BY-SA 4.0Updated 9 August 2025
XCOPY
Company typeCommand-line utility
IndustrySoftware
FoundedDOS version 3.2
ProductsFile and directory copying

XCOPY is a command-line utility used to duplicate files and entire directory structures either within the same system or across network connections. Created to enhance the capabilities of the copy command, it functions as an addition rather than a substitute.

The term stands for extended copy and is commonly represented as XCOPY or xcopy. Historically, it appeared in uppercase in DOS systems, but contemporary practice often employs lowercase. Both variations persist due to the command’s longstanding presence.

Originating with DOS version 3.2, xcopy is implemented in IBM PC DOS, MS-DOS, OS/2, Windows platforms, FreeDOS, ReactOS, among others. DR DOS 6.0 and ROM-DOS provide their distinct versions. The FreeDOS iteration was authored by Rene Ableidinger under the GNU General Public License (GPL), while J. Edmeades developed the ReactOS variant, which is distributed under the GNU Lesser General Public License (LGPL).

Microsoft designated xcopy as deprecated in favor of robocopy starting with Windows Vista. Nevertheless, since xcopy remains fully accessible in Windows 11 without any deprecation alerts, this classification might have been reconsidered.

Compression

Beginning with Windows Server 2019 and Windows 10, xcopy supports a /compress switch designed to improve data transfer efficiency over networks. When this option is active and the destination supports Server Message Block (SMB) compression, copying files that compress well can result in significant speed improvements.

Deployment

The term xcopy deployment describes a method of installing software by merely replicating files using xcopy or similar utilities. Unlike conventional Windows installations that involve registry modifications or component registration, this approach is simple but limited in scope. More sophisticated installation requirements typically depend on dedicated installers like Windows Installer, InnoSetup, InstallShield, or NSIS to handle complex setup tasks.

Limitations

The command encounters an "insufficient memory" error if the combined length of the full file path and filename surpasses 254 characters. The introduction of the "/J" option (available since Server 2008R2) allows unbuffered copying of large files, reducing memory consumption during the process.

xcopy cannot copy files currently locked by other applications and does not support Windows Volume Shadow Copy, which restricts its effectiveness for backing up active systems.

Example

To create a new folder by duplicating all contents—including files marked as hidden or system and empty directories—use:

<syntaxhighlight lang="doscon"> >xcopy e:\existing e:\newcopy /e /i /h </syntaxhighlight>

When dealing with paths containing spaces, enclose them within quotation marks:

<syntaxhighlight lang="doscon"> >xcopy "D:\Documents and Settings\MY.USERNAME\My Documents\*" "E:\MYBACKUP\My Documents\" /D/E/C/Y </syntaxhighlight>

To copy an entire drive to a mapped network location while ignoring errors in restartable mode:

<syntaxhighlight lang="doscon"> >xcopy *.* z:\Netmirror /E /V /C /F /H /Y /Z 1>out.txt 2>err.txt </syntaxhighlight>

Copy a single file without prompting for confirmation, regardless of whether it is a file or directory:

<syntaxhighlight lang="doscon"> >cmd /c echo F | xcopy "c:\directory 1\myfile" "c:\directory 2\myfile" </syntaxhighlight>

See also

Further reading

External links