XCOPY
Template:Short description
Template:Distinguish
{{#invoke:Infobox|infobox}}Template:Template other{{#invoke:Check for unknown parameters | check | showblankpositional=1
| unknown = Template:Main other
| preview = Page using Template:Infobox software with unknown parameter "_VALUE_"|ignoreblank=y
| AsOf | author | background | bodystyle | caption | collapsetext | collapsible | developer | discontinued | engine | engines | genre | included with | language | language count | language footnote | latest preview date | latest preview version | latest release date | latest release version | latest_preview_date | latest_preview_version | latest_release_date | latest_release_version | licence | license | logo | logo alt | logo caption | logo upright | logo size | logo title | logo_alt | logo_caption | logo_upright | logo_size | logo_title | middleware | module | name | operating system | operating_system | other_names | platform | programming language | programming_language | released | replaced_by | replaces | repo | screenshot | screenshot alt | screenshot upright | screenshot size | screenshot title | screenshot_alt | screenshot_upright | screenshot_size | screenshot_title | service_name | size | standard | title | ver layout | website | qid
}}Template:Main other
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
command; but to augment it instead of replacing it.
The name, short for extended copy,<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> 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.<ref name="RUNNINGMSDOS">Template:Cite book</ref> The command is available on IBM PC DOS, MS-DOS, OS/2,<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> Windows,<ref>Xcopy</ref> FreeDOS,<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> ReactOS,<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> and other systems. DR DOS 6.0<ref name="drdos6userguide">DR DOS 6.0 User Guide Optimisation and Configuration Tips</ref> and ROM-DOS<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> include an implementation of the <syntaxhighlight lang="text" class="" style="" inline="1">XCOPY</syntaxhighlight> command. The FreeDOS version was developed by Rene Ableidinger and is licensed under the GPL.<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> The ReactOS version was developed J. Edmeades and is licensed under the LGPL.<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref>
As stated by the command that ships with Vista (reported via <syntaxhighlight lang="text" class="" style="" inline="1">xcopy /?</syntaxhighlight>), Microsoft deprecated <syntaxhighlight lang="text" class="" style="" inline="1">xcopy</syntaxhighlight> in favor of robocopy
.<ref>{{#invoke:citation/CS1|citation
|CitationClass=web
}}</ref> 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.
UseEdit
CompressionEdit
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. <ref>{{#invoke:citation/CS1|citation
|CitationClass=web
}}</ref><ref>Output from xcopy /?
in Windows 10 includes "/COMPRESS - Request network compression during file transfer where applicable".</ref>
DeploymentEdit
xcopy deployment or xcopy installation describes installing an application via the relatively simply operation of copying files Template:Endash either using <syntaxhighlight lang="text" class="" style="" inline="1">xcopy</syntaxhighlight> 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.
LimitationsEdit
The command fails with an "insufficient memory" error when the path plus filename is longer than 254 characters.<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> An option "/J" copies files without buffering;<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> 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.<ref>CreateFileA function (fileapi.h)</ref> 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.
ExampleEdit
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.
<syntaxhighlight lang="doscon"> >xcopy e:\existing e:\newcopy /e /i /h </syntaxhighlight>
If the pathnames include spaces, they must be enclosed in quotation marks.
<syntaxhighlight lang="doscon"> >xcopy "D:\Documents and Settings\MY.USERNAME\My Documents\*" "E:\MYBACKUP\My Documents\" /D/E/C/Y </syntaxhighlight>
Copy entire drive in to a mapped network drive while ignoring any errors in network 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 prompt if it is a file or a directory
<syntaxhighlight lang="doscon"> >cmd /c echo F | xcopy "c:\directory 1\myfile" "c:\directory 2\myfile" </syntaxhighlight>
See alsoEdit
ReferencesEdit
Further readingEdit
External linksEdit
- xcopy | Microsoft Docs
- Switches That You Can Use with Xcopy and Xcopy32 Commands, Windows 95, Windows 98, Windows Me
- Xcopy, Microsoft Windows XP
- VariableGHz article depicting CRC errors and XCOPY as a solution
- XCOPY Command in a post build event does not execute
- XP_CMDSHELL Does Not Work with XCOPY
- See also Microsoft Product Documentation
- How to deploy an ASP.NET Web application using Xcopy deployment
- .NET Development: Determining When to Use Windows Installer Versus XCOPY
- Visual C++ How to: Deploy using XCopy