XCOPY

Shell command for copying files
title: "XCOPY" type: doc version: 1 created: 2026-02-28 author: "Wikipedia contributors" status: active scope: public tags: ["external-dos-commands", "file-copy-utilities", "msx-dos-commands", "os/2-commands", "reactos-commands"] description: "Shell command for copying files" topic_path: "general/external-dos-commands" source: "https://en.wikipedia.org/wiki/XCOPY" license: "CC BY-SA 4.0" wikipedia_page_id: 0 wikipedia_revision_id: 0
::summary Shell command for copying files ::
::data[format=table title="Infobox software"]
| Field | Value |
|---|---|
| screenshot | ReactOS-0.4.13 xcopy command 667x690.png |
| caption | The ReactOS xcopy command |
| developer | Microsoft, IBM, DR, Datalight, Novell, Rene Ableidinger, ReactOS Contributors |
| released | |
| 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 | |
| :: |
| name =
| logo =
| screenshot = ReactOS-0.4.13 xcopy command 667x690.png
| screenshot size =
| caption = The ReactOS xcopy command
| developer = Microsoft, IBM, DR, Datalight, Novell, Rene Ableidinger, ReactOS Contributors
| released =
| latest release version =
| latest release date =
| 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
XCOPY is a shell command for copying files and directory trees from one directory to another or across networks. The command was designed to be more functional than the [copy](copy-command) command, but to augment it instead of replacing it.
The name, short for extended copy, is often written as XCOPY or xcopy. As was the prevailing style for DOS systems, the name was typically written in all caps when DOS was a prevalent technology and even today in the context of such obsolete systems. In modern times and for modern systems, prevailing style is to write command names in lower case. Since the command's use spans from DOS to current systems, both representations are commonly used.
The command first appeared in DOS 3.2. The command is available on IBM PC DOS, MS-DOS, OS/2, Windows, FreeDOS, ReactOS, and other systems. DR DOS 6.0 and ROM-DOS include an implementation of the command. The FreeDOS version was developed by Rene Ableidinger and is licensed under the GPL. The ReactOS version was developed J. Edmeades and is licensed under the LGPL.
As stated by the command that ships with Vista (reported via ), Microsoft deprecated in favor of [robocopy](robocopy). But, since the version in the current release of Windows does not state this and the command is still available in Windows long after Vista was released in 2007, deprecation may have been reversed.
Use
Compression
Since Windows Server 2019 and Windows 10, the command supports a /compress option to optimize throughput across a network. With this option enabled, if the destination computer supports Server Message Block (SMB) compression and the files are very compressible (i.e. not already compressed), there may be significant improvements to performance.
Deployment
xcopy deployment or xcopy installation describes installing an application via the relatively simply operation of copying files either using or another file copying facility. In contrast, many Windows application installations include additional and more complicated operations such as modifying the Windows Registry. Even when an application is implemented using files (that can be installed via a copy operation), many common facilities provided by Windows require registration before they are available to an application. Often, specialized installation tools (such as Windows Installer, InnoSetup, InstallShield, and NSIS) are used to coordinate these relatively complex operations.
Limitations
The command fails with an "insufficient memory" error when the path plus filename is longer than 254 characters. An option "/J" copies files without buffering; moving very large files without the option (available only after Server 2008R2) can consume all available RAM on a system.
The command will not copy files that are being held open by another process. The command does not support the Windows Volume Shadow Copy service which allows processes to access open files. Therefore, the command is not useful for backing up live systems.
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.
::code[lang=doscon]
xcopy e:\existing e:\newcopy /e /i /h ::
If the pathnames include spaces, they must be enclosed in quotation marks.
::code[lang=doscon]
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.
::code[lang=doscon]
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
::code[lang=doscon]
cmd /c echo F | xcopy "c:\directory 1\myfile" "c:\directory 2\myfile" ::
References
References
- (2006-11-01). "Windows NT File System Files". Microsoft.
- (2003). "Running MS-DOS Version 6.22 (20th Anniversary Edition), 6th Revised edition". [[Microsoft Press]].
- "JaTomes Help - OS/2 Commands".
- [https://technet.microsoft.com/en-us/library/cc771254.aspx Xcopy]
- "The FreeDOS Project blog: FreeDOS commands quick-reference".
- "Reactos/Base/Applications/Cmdutils/Xcopy at master · reactos/Reactos".
- [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]
- "Datalight ROM-DOS User's Guide".
- (2007-09-22). "FreeDOS 1.2 Updates Package - XCopy (FreeDOS Base)". Ibiblio.org.
- (26 November 2021). "Reactos/Reactos".
- Pietrek, Matt. (2007-01-16). "Robocopy built into Vista". Under The Hood (an MSDN blog).
- Smith, Russell. (27 November 2020). "SMB Compression Lowers Bandwidth and Improves Copy Times in Windows Server and Azure". Petri.
- Output from
xcopy /?in Windows 10 includes "/COMPRESS - Request network compression during file transfer where applicable". - Maciak, Luke. (2007-02-05). "Xcopy: Insufficient Memory".
- (2019-05-01). "Technet: Xcopy".
- [https://msdn.microsoft.com/en-us/library/aa363858.aspx CreateFileA function (fileapi.h)]
::callout[type=info title="Wikipedia Source"] This article was imported from Wikipedia and is available under the Creative Commons Attribution-ShareAlike 4.0 License. Content has been adapted to SurfDoc format. Original contributors can be found on the article history page. ::