title: batch file about syntax and result
body: <blockquote>
  <p>compare.txt:</p>
  </blockquote>
  <pre><code>a_max&lt;=a_min
  </code></pre>
  <hr />
  <blockquote>
  <p>Here is my batch file:</p>
  </blockquote>
  <pre><code>@echo off
  for %%n in (1 1 9) do 
  
  set \a &quot;is_p=%random%&quot;
  set \a &quot;n=%random%&quot;
  set \a &quot;a_max=%random%&quot;
  set \a &quot;a_min=%random%&quot;
  set \a &quot;a_min=%random%&quot;
  if &quot;is_p%2&quot;==&quot;1&quot; (%is_p%=1)
  if &quot;is_p%2&quot;==&quot;0&quot; (%is_p%=0)
  for %%n in (compare.txt) do ( 
   %a_min%=%random%
  )
  echo %is_p% %n% %a_max% %a_min% &gt;&gt; input.txt 
  allsort &lt; input.txt &gt; results.txt
  ) 
  </code></pre>
  <hr />
  <blockquote>
  <p>The result in input.txt is:</p>
  </blockquote>
  <pre><code>12405 220 26501 3870  
  12405 220 26501 3870  
  12405 220 26501 3870  
  </code></pre>
  <hr />
  <blockquote>
  <p>My questions are:</p>
  </blockquote>
  <ol>
  <li>I hope to run 9 times in for loop, but actually it did run 3 times.</li>
  <li>I use %random%, and why the result is the same after each time?</li>
  <li>I also hope that is_p is either 1 or 0 after if statement, but why actually it is a random number?</li>
  </ol>
  <hr />
  <blockquote>
  <p>P.S</p>
  </blockquote>
  <ul>
  <li><p>I'm the beginner of learning how to write batch file, so maybe there are many errors.</p>
  </li>
  <li><p>English is not my mother tongue, so please tolerate my poor English,thanks. :)</p>
  <p>To @Stephan,%is_p%=%random% means that I want to assign a random number to the variable,is_p.<br />
  Also, if statement means that if is_p%2=1, set is_p=1.And if is_p%2=0, set is_p=0.</p>
  </li>
  </ul>
  <blockquote>
  <p>After correct the code, it can run 9 times, but the result each time is still the same.</p>
  </blockquote>