33

I know that xcopy has more options however are there any benefits to using copy rather than xcopy?

39
  1. xcopy is an external program, while copy is part of the interpreter (cmd.exe, command.com). This means that xcopy might not be present on another machine or a rescue disk.

    Since we have Windows and rescue CDs, that isn't really an issue anymore.

  2. copy can concatenate files.

    copy file1 + file2 file3
    

    creates a file (file3) which contains file1's and file2's contents.

  3. copy can copy more than just files.

    For example,

    copy con file
    

    lets you write directly from the keyboard (console) to file.

    Likewise, you can print a file using

    copy file prn
    copy file \\computer\printer
    

    where the latter is for shared printers.

    You can even combine the above: The command

    copy con prn
    

    lets you write directly to the printer.

  • 5
    Also, it's one less character to type when invoking it. :) – Orangutech May 31 '12 at 21:33
  • Wow, thanks for info regarding files concatenation. I've just found out it and understood why my result file was so big. You've made my day. – Johnny_D Oct 10 '13 at 13:57
21

I think the main difference is (or was) that xcopy is able to copy folder hierarchies and copy was intended to work on files only.
That being said, I don't think there is anything to gain (functionality- or performance-wise) from using copy.

Please note, even xcopy is outdated by today's standards. Robocopy is the new copy utility of choice on modern Windows platforms.

Also note that all the mentioned copy utilities have Wikipedia articles that could contain further information:

1

Anyone remember DOS on dual floppy PCs? Xcopy minimises the number of read seeks by loading multiple files into memory on a single read to speed up the copy. Probably still makes a trivial speed improvement with HDDs.

  • 1
    At the risk of splitting hairs, this is not, strictly speaking, an answer to the question, since it asks for benefit(s) of copy over xcopy.  But, IMO, this is a valid contribution to the discussion. – Scott Jan 10 at 1:03
0

If you consider Powershell a "command line" then there is another "copy" command available. The Powershell "copy" apparently maps to a cmdlet.

One thing not mentioned by the other answers is that since Powershell expands a deeply embedded wildcard at the shell level, this command will work (only from PS not from DOS):

% copy G:\git\one\source\*\morePath\SomePattern*.dll destDir

while xcopy claims "file not found" since it accepts a single source.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.