title: Visual Studio 2012 Post Build Events - Error Code 255
body: <p>Here is my attempt to copy my application executable to another folder changing it's name:</p>
  
  <pre><code>IF $(ConfigurationName) == Release (
      SET DESTINATION=$(ProjectDir)Output\Distribution
  
      IF NOT EXIST "%DESTINATION%" ( MD "%DESTINATION%" )
  
      XCOPY /Q /Y "$(TargetPath)" "%DESTINATION%"
      RENAME "%DESTINATION%\$(TargetFileName)" "$(TargetName).Plain$(TargetExt)"
  )
  </code></pre>
  
  <p>I've tried everything to make it work, but it always throw error code 255 or 1, it depends. Running that code with a plain batch file works like a charm!</p>