title: How to stop batch script on del failure
body: <p>We have a batch script that removes files (<code>del</code>) and directories (<code>rd</code>).  Does anyone know how to halt (fail) execution of the script if any of these delete statements fail?  They could fail if a file/directory is locked by Windows.  Thanks.</p>
  
  <p><strong>Update</strong></p>
  
  <p>Statements I'm using:</p>
  
  <p>Del: <code>del *.* /S /Q</code></p>
  
  <p>RD: <code>FOR /D  %%G in (*) DO RD /s /q %%G</code></p>