title: How do I use a variable I set in a for loop in a batch script?
body: <p>This should be super easy, but for some reason reading answers and looking a tutorials only results in syntax errors when I try to run my batch file...Anyways, all I want to do is to set a variable inside a for loop and then use that name in order to rename a folder. And for some reason cmd is making this a chore.</p>
  <pre class="lang-py prettyprint-override"><code>FOR /L %%G IN (15,5,45) DO (
  
  REM Fourth simulation, try out dt = 70 fs (B2)
  python script.py -i input.xyz -ss %%G
  python energy_plot.py -i input\energy.out
  set &quot;name=B%%G&quot;
  ren argon_input %name%
  
  )
  </code></pre>
  <p>It keeps telling me I have a syntax error in there but I just can't see what the problem is. For some reason it doesn't want to set my name variable.</p>