title: How to get %s recognized in a .bat file?
body: <p>I have a 3-command .bat file that runs fine as 3 separate commands (entered 1 at a time into command line) but does not work when I put them as 3 lines in a bat file.</p>
  
  <p>Here's the file:</p>
  
  <pre><code>mogrify -format pgm ephemeral:*.png
  pause
  CALL forfiles /M *.pgm /C "cmd /c for %s in (@fname) do DebayerGPU.exe -demosaic DFPD_R -CPU -pattern GRBG -i %s.pgm -o %s.ppm
  pause
  mogrify -format png ephemeral:*.ppm
  </code></pre>
  
  <p>The first command runs fine, but the command line gives me this error for the second command:</p>
  
  <pre><code>s.pgm was unexpected at this time
  </code></pre>
  
  <p>The reason I have that for loop with fname and %s is because the debayer.exe program doesn't understand @fname.pgm as a filename, but it does realize that's means bring in a string, so it does that, and then forfiles recognizes @fname and replaces it with the current file name.</p>
  
  <p>Any ideas on how to solve this problem?</p>
  
  <p>I have tried:</p>
  
  <ol>
  <li><p>Putting <code>%%</code> instead of <code>%</code></p></li>
  <li><p>Putting a <code>^</code> infront of each <code>%</code></p></li>
  <li><p>Adding the <code>CALL</code> that is in the above code</p></li>
  <li><p>Adding semicolons to the end of each line.</p></li>
  </ol>