XCOPY
{{Short description|Computing command}}
{{distinguish|XCOPY (artist)}}
{{Infobox software
| 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 = {{Release year|df=yes|1986}}
| 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
}}
In computing, XCOPY
is a command used on IBM PC DOS, MS-DOS, IBM OS/2,{{cite web |url=http://www.jatomes.com/Help/Os2Cmd.php#XCOPY |title=JaTomes Help - OS/2 Commands |website=www.jatomes.com |url-status=dead |archive-url=https://web.archive.org/web/20190414130029/http://www.jatomes.com/Help/Os2Cmd.php |archive-date=2019-04-14}} Microsoft Windows,[https://technet.microsoft.com/en-us/library/cc771254.aspx Xcopy] FreeDOS,{{cite web |url=http://freedos-project.blogspot.com/2018/06/freedos-commands-quick-reference.html |title=The FreeDOS Project blog: FreeDOS commands quick-reference |website=freedos-project.blogspot.com |url-status=dead |archive-url=https://web.archive.org/web/20180722155725/http://freedos-project.blogspot.com/2018/06/freedos-commands-quick-reference.html |archive-date=2018-07-22}} ReactOS,{{cite web|url=https://github.com/reactos/reactos/tree/master/base/applications/cmdutils/xcopy|title = Reactos/Base/Applications/Cmdutils/Xcopy at master · reactos/Reactos|website = GitHub}} 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,{{cite web |url=http://support.microsoft.com/?scid=kb;en-us;100012 |title=Windows NT File System Files |date=2006-11-01 |work=Microsoft Help and Support |publisher=Microsoft}} 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.{{Cite book|author-last=Wolverton|author-first=Van|title=Running MS-DOS Version 6.22 (20th Anniversary Edition), 6th Revised edition|date=2003|publisher=Microsoft Press|isbn=0-7356-1812-7}}
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.{{cite web |url=http://blogs.msdn.com/matt_pietrek/archive/2007/01/16/robocopy-built-into-vista.aspx |title=Robocopy built into Vista |last=Pietrek |first=Matt |authorlink=Matt Pietrek |date=2007-01-16 |work=Under The Hood (an MSDN blog)}}
DR DOS 6.0[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] and Datalight ROM-DOS{{cite web|url=https://www.datalight.com/assets/files/ROM-DOS_Users_Guide.pdf|title=Datalight ROM-DOS User's Guide|website=www.datalight.com}} include an implementation of the {{code|XCOPY}} command.
The FreeDOS version was developed by Rene Ableidinger and is licensed under the GPL.{{cite web|url=http://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/distributions/1.2/repos/pkg-html/xcopy.html |title=FreeDOS 1.2 Updates Package - XCopy (FreeDOS Base) |publisher=Ibiblio.org |date=2007-09-22 |accessdate=2022-09-08}}
J. Edmeades developed the Wine-compatible version that is included in ReactOS. It is licensed under the LGPL.{{cite web|url=https://github.com/reactos/reactos/blob/master/base/applications/cmdutils/xcopy/xcopy.c|title=Reactos/Reactos|website=GitHub|date=26 November 2021}}
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.{{cite web |title=SMB Compression Lowers Bandwidth and Improves Copy Times in Windows Server and Azure|last=Smith |first=Russell |work=Petri |date=27 November 2020 |url= https://petri.com/smb-compression-lowers-bandwidth-and-improves-copy-times-in-windows-server-and-azure}}Output from xcopy /?
in Windows 10 includes "/COMPRESS - Request network compression during file transfer where applicable".
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.{{cite web |url=http://www.terminally-incoherent.com/blog/2007/02/05/xcopy-insufficient-memory |title=Xcopy: Insufficient Memory|last=Maciak |first=Luke |authorlink=Luke Maciak |date=2007-02-05}} An option "/J" copies files without buffering;{{cite web |url=https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/xcopy |title=Technet: Xcopy |date=2019-05-01}}
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
[https://msdn.microsoft.com/en-us/library/aa363858.aspx CreateFileA function (fileapi.h)]
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
References
{{Reflist}}
Further reading
- {{Cite book|author-last=Cooper|author-first=Jim|title=Special Edition Using MS-DOS 6.22, Third Edition|date=2001|publisher=Que Publishing|isbn=978-0789725738}}
- {{Cite book|author1=Kathy Ivens|author2=Brian Proffit|year=1993|title=OS/2 Inside & Out|publisher=Osborne McGraw-Hill|isbn=978-0078818714}}
- {{Cite book|author=John Paul Mueller|year=2007|title=Windows Administration at the Command Line for Windows Vista, Windows 2003, Windows XP, and Windows 2000|publisher=John Wiley & Sons|isbn=978-0470165799}}
External links
{{Wikibooks|Guide to Windows Commands}}
- [https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/xcopy xcopy | Microsoft Docs]
- [https://support.microsoft.com/en-us/help/289483/switches-that-you-can-use-with-xcopy-and-xcopy32-commands Switches That You Can Use with Xcopy and Xcopy32 Commands], Windows 95, Windows 98, Windows Me
- [http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/xcopy.mspx?mfr=true Xcopy], Microsoft Windows XP
- [http://variableghz.com/2008/12/dos-bypassing-the-cyclic-redundancy-check-and-other-errors/ VariableGHz article depicting CRC errors and XCOPY as a solution]
- [http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=92736 XCOPY Command in a post build event does not execute]
- [http://support.microsoft.com/default.aspx?scid=kb;en-us;152134 XP_CMDSHELL Does Not Work with XCOPY]
- See also [https://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/xcopy.mspx?mfr=true Microsoft Product Documentation]
- [https://support.microsoft.com/en-us/help/326355/how-to-deploy-an-asp-net-web-application-using-xcopy-deployment How to deploy an ASP.NET Web application using Xcopy deployment]
- [http://msdn2.microsoft.com/en-us/library/aa302347.aspx .NET Development: Determining When to Use Windows Installer Versus XCOPY]
- [http://msdn2.microsoft.com/en-us/library/ms235291(VS.80).aspx Visual C++ How to: Deploy using XCopy]
{{Windows commands}}