title: Escape ampersands in variables - win batch
body: <p>I have a variable that contains ampersands and I need to create another variable that contains the first one. I know the "&amp;" character <a href="https://stackoverflow.com/questions/1327431/how-do-i-escape-ampersands-in-batch-files">can be escaped with carret (^)</a> but I have no idea how to escape the text inside a variable.</p>
  
  <pre><code>set Name1 = Red ^&amp; Green
  set Name2 = %Name1% ^&amp; Blue
  </code></pre>
  
  <p><i>'Green' is not recognized as an internal or external command, operable program or batch file.</i></p>
  
  <p>I can't even "echo" the variables containing ampersands - I get the same error.</p>
  
  <p>I need to use the variables in order to type their contents to the output or to manipulate files named by the variables like</p>
  
  <pre><code>type "%Name1%.txt"
  type "%Name2%.txt"
  </code></pre>