title: Batch Files - Error Codes
body: <p>I have a target defined in MSBUILD to execute a batch file which consists of multiple (close to a 100 or more) xcopy commands. </p>
  
  <p>I have observed that the MSBUILD only fails in case of the last xcopy failing in the batch files. If any other xcopy fails and the last one succeeds, MSBUILD considers as build succeeded. </p>
  
  <p>Is there a way that we can trap all the errors and return failures in the end of the batch file so that MSBUILD can fail even on a single failure anywhere in the batch file. </p>
  
  <p>Thanks
  Shravan</p>