title: How to pass a parameter to a batch file containing a % without it 'breaking'?
body: <p><strong>The Problem</strong></p>
  
  <p>In a main batch file, values are pulled from a .txt file (and <code>SET</code> as values of variables within this batch file). These values may each contain <code>%</code> characters. </p>
  
  <p>These are read from the .txt file with no issues. However, when a variable with a value containing a <code>%</code> character is passed to a second batch file, the second batch file interprets any <code>%</code> characters as a variable expansion. <em>(Note: There is <strong>no</strong> control over the second batch file.)</em></p>
  
  <p><strong>Example</strong></p>
  
  <pre><code>echo %PERCENTVARIABLE%
  </code></pre>
  
  <p>Output: <code>I%LOVE%PERCENT%CHARACTERS%</code></p>
  
  <p>When passed to a second file and then echo'ed, would <em>(probably)</em> become <code>IPERCENT</code>, as it interprets <code>%LOVE%</code> and <code>%CHARACTERS%</code> as unset variables.</p>
  
  <hr>
  
  <p><strong>Research</strong></p>
  
  <p>I found the syntax to find and replace elements within a string in a batch file, as I thought I could potentially replace a <code>%</code> character with <code>%%</code> in order to escape it. However I cannot get it to work. </p>
  
  <p>The syntax is - </p>
  
  <pre><code>set string=This is my string to work with.
  set string=%string:work=play%
  echo %string%
  </code></pre>
  
  <p>Where the output would then be <code>This is my string to play with.</code>.</p>
  
  <hr>
  
  <p><strong>Questions</strong></p>
  
  <ol>
  <li><strong>Is it possible to escape <code>%</code></strong> characters using the find and replace syntax
   in a variable? (If not, is there another way?)</li>
  <li><strong>Is it advisable to do so?</strong> (Could using these escape characters cause any issue in the second batch file which (as mentioned above) we would have no control over?) </li>
  <li><strong>Is there another way to handle this issue</strong>, if the above is not possible?</li>
  </ol>