title: Problem Executing Batch File in Pre-Build Event
body: <p>I'm trying to execute a batch file during a pre-build event.  I have a new project and have added <strong>foo.bat</strong> to it.  The file contains the following line:</p>
  
  <pre><code>echo bar
  </code></pre>
  
  <p>When I set the pre-build event command line to <strong>foo.bat</strong>, I get the following error:</p>
  
  <blockquote>
    <p>The command "foo.bat" exited with code 9009.</p>
  </blockquote>
  
  <p>When I set the pre-build event command line to <strong>call foo.bat</strong>, I get the following error:</p>
  
  <blockquote>
    <p>The command "call foo.bat" exited with code 1.</p>
  </blockquote>
  
  <p>Everything I've read related to those codes generally indicates that there is a problem with the contents of the batch file (not likely in this case) or that the system cannot find the batch file.</p>
  
  <p>The batch file works fine from a command prompt.  Things I've tried already:  Created the file using different tools, various encodings, placing exit 0 in the file, different build actions for the file, and copying the file to the output directory.  All with no luck.</p>
  
  <p>What am I missing?  It has to be something simple.</p>
  
  <p><strong>Update:</strong>  Yep, it was simple - the length of the path was too long.  See answer below for details.</p>
  
  <p>Thanks!</p>