Getting ROBOCOPY to return a "proper" exit code?

Posted by Lasse V. Karlsen on Super User See other posts from Super User or by Lasse V. Karlsen
Published on 2011-05-07T13:03:35Z Indexed on 2012/07/04 3:18 UTC
Read the original article Hit count: 405

Filed under:
|

Is it possible to ask ROBOCOPY to exit with an exit code that indicates success or failure?

I am using ROBOCOPY as part of my TeamCity build configurations, and having to add a step to just silence the exit code from ROBOCOPY seems silly to me.

Basically, I have added this:

EXIT /B 0

to the script that is being run.

However, this of course masks any real problems that ROBOCOPY would return.

Basically, I would like to have exit codes of 0 for SUCCESS and non-zero for FAILURE instead of the bit-mask that ROBOCOPY returns now.

Or, if I can't have that, is there a simple sequence of batch commands that would translate the bit-mask of ROBOCOPY to a similar value?

© Super User or respective owner

Related posts about robocopy

Related posts about exit-code