title: How do I conditionally turn @ECHO ON/OFF in a Windows batch file?
body: <p>I have a batch file that can be run locally or on the build server to do some kind of interesting job. On the local machine, I want <code>@ECHO OFF</code> so that your console isn't full of debug strings. On the build server, I'd rather have <code>@ECHO ON</code> so that failures can be investigated.</p>
  
  <p>The build server context can be determined if a special environment variable exists (<code>TEAMCITY_PROJECT_NAME</code>). So, I thought I could do something like</p>
  
  <pre><code>IF DEFINED TEAMCITY_PROJECT_NAME @ECHO ON ELSE @ECHO OFF
  </code></pre>
  
  <p>But, that's not working, I get the <code>IF</code> statement echoed along with everything else... any thoughts?</p>