What makes XCOPY so X?

Raymond Chen

Raymond

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.

Raymond Chen
Raymond Chen

Follow Raymond