title: Post build SET command and %variable% error
body: <p>I am a batch newbie and I might have made a mistake. But I have the following post-build event:</p>
  
  <pre><code>IF $(ConfigurationName) == Release (
      SET RELEASEPATH = "C:\Users\Synercoder\Documents\Visual Studio 2010\Releases\$(ProjectName)"
      IF NOT EXIST  %RELEASEPATH% (
          GOTO MAKEDIR
      ) ELSE (
          GOTO DIREXISTS
      )
      :MAKEDIR
      MKDIR %RELEASEPATH%
      :DIREXISTS
      COPY /Y "$(TargetDir)$(ProjectName).dll" "%RELEASEPATH%\$(ProjectName).dll"
      COPY /Y "$(TargetDir)$(ProjectName).pdb" "%RELEASEPATH%\$(ProjectName).pdb"
  )
  </code></pre>
  
  <p>But this fails with code 255. If I replace all the <code>%RELEASEPATH%</code> with the actual path it works. I looked up the <code>SET</code> command and I think that I used it right... But like I said I am a batch newbie.</p>
  
  <p>Any clue why this fails in my case?</p>
  
  <p>If I use the following code this is my output:</p>
  
  <pre><code>SET RELEASEPATH = test
  ECHO "%RELEASEPATH%"
  SET RELEASEPATH = "test"
  ECHO "%RELEASEPATH%"
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>""
  ""
  </code></pre>