January 19th, 2016

What makes XCOPY so X?

There’s COPY and there’s XCOPY. First things first: I don’t know what the X stands for. Extra? Exorbitant? Excellent? My guess is Extended, but it’s just a guess.

The built-in MS-DOS COPY command copied one file at a time. This was a real pain if you wanted to copy a bunch of files from one floppy disk to another, and you had a single-floppy machine. Copying all the files from one disk to another went like this:

  • You type COPY A:*.* B:
  • The COPY command reads FILE1.TXT into memory.
  • You are then told
    Insert diskette for drive B: and press any key to continue.
    
  • You swap disks and press a key.
  • The COPY command writes FILE1.TXT to the destination disk.
  • You are then told
    Insert diskette for drive A: and press any key to continue.
    
  • You swap disks and press a key.
  • The COPY command reads FILE2.TXT into memory.
  • You are then told
    Insert diskette for drive B: and press any key to continue.
    
  • You get the idea.

This gets really annoying if you are copying a bunch of small files, because you have to swap disks after every single file.

Enter XCOPY.

The XCOPY program improves upon the built-in COPY command by reading as many files from the source as will fit into memory before asking you to swap disks. Then it would write out everything before asking you to put the original disk back in. If you had a lot of memory (like 256KB), you could read the entire floppy disk into RAM, and then write it all out. Boom, your files are copied with only a single disk swap.

This fancy file copying was in a separate program because adding it to the core COMMAND.COM would have made it too big. (It is to the command processor’s advantage to stay small so that it could remain in the transient program area and avoid having to be reloaded.)

As a result, there was a special wrinkle: Since XCOPY.EXE is a separate program, how do you copy files between two floppy disks, neither of which have a copy of XCOPY.EXE on them?

That’s where the /W option comes in. I’m guessing that the W stands for “wait”: It makes XCOPY wait for a keypress before starting to copy files. This gives you a chance to remove the floppy that has XCOPY and insert the disk containing the files you want to copy.

Topics
History

Author

Raymond has been involved in the evolution of Windows for more than 30 years. In 2003, he began a Web site known as The Old New Thing which has grown in popularity far beyond his wildest imagination, a development which still gives him the heebie-jeebies. The Web site spawned a book, coincidentally also titled The Old New Thing (Addison Wesley 2007). He occasionally appears on the Windows Dev Docs Twitter account to tell stories which convey no useful information.

0 comments

Discussion are closed.