Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When using robocopy windows utility, what flags do I set so that robocopy aborts on the very first error it sees, similar to xcopy /dry command?

I need to mirror two dirs, and on occasion some files would be locked. I do not want robocopy to continue trying to copy files, or override the files that are not locked - rather the very first error should stop the whole copy process.


I already have the /R set to 0 - unfortunately that it only applies to a single file, NOT to the whole copying process. Hence, the first file is ignored (instead of stopping the copying), but subsequent files are copied.

share|improve this question

migrated from Oct 7 '09 at 22:27

This question came from our site for professional and enthusiast programmers.

robocopy is a windows command that performs file copy operations and extends copy and xcopy functionality. It ships with the windows SDK which is included in several software distributed by Microsoft. I think this is the correct forum. – A Dwarf Oct 7 '09 at 23:00
saw the update. edited answer – A Dwarf Oct 7 '09 at 23:18

Use the Retries argument and set it to 0:


Robocopy will not retry if an error is found and the command is aborted. What you are experiencing is the fact this option is set by default to 1 thousand, or something similar.

As an added note, you can save the retries option to the registry which I believe may be useful in your case. This will save you from having to remember to set it to 0 every time and feels more natural, since you may want to explicitly tell robocopy to retry n times, instead of having to explicitly tell robocopy to not retry.

/R:0 /REG

Use /REG when applying /R: and that setting will be saved to the registry for future use.

If you wish to abort the whole robocopy operation, I'm afraid this isn't possible under robocopy. Not to my knowledge at least.

You will in that case want to use XXCOPY and the /C0 option.

Robocopy philosophy (being a replication tool) stops it from doing this... well, in my view at least until rollover is implemented.

share|improve this answer
please read the update – Yurik Oct 7 '09 at 23:03

We are using an extension to ROBOCOPY called RoboCopyPlus ( It adds emailo notification and condenses the log files and attaches them to the email. It adds a whole heap of switches to the standard set of ROBOCOPY switches. Not sure if it woudl do what you're looking for but I'd give it a try.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .