title: Special Characters in Batch File
body: <p>Special characters in batch files are a pain, but I haven't found the right workaround for properly escaping the first two characters of this particular string I'm trying to pass the application.</p>
  
  <pre><code>SET pass=^&amp;AntiBatchfileString
  A_Program.exe /pass=%pass%
  </code></pre>
  
  <p>Things I have tried:</p>
  
  <pre><code>:: Escaping the escape twice, first for ^, second for &amp;.
  SET pass=^^^^&amp;AntiBatchfileString
  echo %pass%
  
  :: Combining escapes.
  SET first=^^
  SET second=^^&amp;AntiBatchfileString
  SET pass=%first%%second%
  echo %pass%
  
  :: Preventing expansion
  SET first=^^
  SET second=^^&amp;AntiBatchfileString
  SET pass=!first!%second%
  echo %pass%
  
  :: I got this to print correctly
  SET "pass=^&amp;AntiBatchfileString"
  echo ^^%pass%
  </code></pre>
  
  <p>Still when passing the last one it doesn't accept the login, I don't know what the final output is. That got me thinking maybe it was trying to do another expansion when passing the parameter to the application, so I quoted that as well.</p>
  
  <pre><code>SET "pass=^&amp;AntiBatchfileString"
  A_Program.exe "/pass=^^%pass%"
  </code></pre>
  
  <p>It's still not working, I'm not sure what I'm missing at this point.</p>