title: Making pre- and post-build event scripts pretty?
body: <p>I have some moderately hefty pre- and post-build event scripts for my Visual Studio 2008 projects (actually it's mainly post-build event scripts).  They work OK in that they function correctly and when I <code>exit 0</code> the build succeeds and when I <code>exit 1</code> the build fails with an error.  However, that error is enormous, and goes something like this:</p>
  
  <pre><code>The command "if Release == Debug goto Foo
  if Release == Release goto Bar
  exit 0
  
  :Foo
  mkdir "abc"
  copy "$(TargetDir)file.dll" "abc"
  [...]
  " exited with code 1.
  </code></pre>
  
  <p>You get the idea.  The entire script is always dumped out as part of the error description.  The entire script is also dumped out in the Output window while the build is happening, too.  So, why have I seen various references on the web to using <code>echo</code> in these scripts?  For example, here's part of an example on one particular site:</p>
  
  <pre><code>:BuildEventFailed
  echo POSTBUILDSTEP for $(ProjectName) FAILED
  exit 1
  :BuildEventOK
  echo POSTBUILDSTEP for $(ProjectName) COMPLETED OK
  </code></pre>
  
  <p>Is there a way to get Visual Studio to suppress all script output apart from what is <code>echo</code>ed (and therefore using <code>echo</code> only to output what you want would make sense), or are these examples just misguided and they don't realize that the whole script is always dumped out?</p>