by Barry Dysert
(last updated September 15, 2014)
XCopy is a command-line utility that comes with Windows. It offers a great deal more functionality than the familiar COPY command, but of course the additional functionality makes XCopy a bit more difficult to use than COPY. This tip provides information on some of its more interesting features so that you can begin using it with very little learning curve.
XCopy provides an easy way to copy both files and directory trees. Its basic syntax is:
C:\> XCOPY source destination [switches]
The /E switch is very useful. It is used to copy directories and subdirectories. So, for example, if you had a directory named C:\Temp\Barry which contained files and subdirectories, you could duplicate Barry's tree structure (i.e., copying all its files and subdirectories) to C:\Temp2 with this command:
C:\> XCOPY C:\Temp\Barry C:\Temp2 /E
Another useful switch is /C, which tells XCopy it should continue copying even if errors occur.
If you're not quite sure what your XCopy command is going to copy, you can simply pretend to execute it, and instead of copying anything it will tell you what it would have copied. This is accomplished by the /L switch.
The /Z switch is very good to know about, especially if you're copying large files over a network. This switch means the copy is "restartable", meaning that if it is interrupted, it can be resumed from where it got cut off instead of having to start copying all over again. While you're at it, I suggest you add the /J switch for copying large files. This switch tells XCopy to use unbuffered I/O, which makes copying of large files goes faster.
There are several other switches to XCopy, mainly having to do with whether to suppress messages or confirmations, deal with files' attributes, and excluded files. A complete list of switches can be obtained by specifying /? on the command line:
C:\> XCOPY /?
This tip (13226) applies to Windows 7 and 8.
Robocopy is a robust file copy utility built into Windows. If you have a lot of file management to do that can't easily be ...Discover More
Got a bunch of files you need renamed? Windows can help you out, but only in a limited manner. This tip shows you how.Discover More
If you ever want to copy user accounts, documents, pictures, etc., from one computer to another, you'll find that Windows ...Discover More
FREE SERVICE: Get tips like this every week in WindowsTips, a free productivity newsletter. Enter your address and click "Subscribe."