title: 'Pretty print' windows %PATH% variable - how to split on ';' in CMD shell
body: <p>I want to run a simple one-liner in the Windows CMD prompt to print my <code>%PATH%</code> variable, one entry per line.</p>
  
  <p>I tried this: <code>for /f "delims=;" %a in ("%path%") do echo %a</code> but this only prints the first entry:</p>
  
  <pre><code>Z:\&gt;for /f "delims=;" %a in ("%path%") do echo %a
  
  Z:\&gt;echo c:\python25\.
  c:\python25\.
  </code></pre>
  
  <p>Also as you can see from the output above, this is also printing the <code>echo %a</code> command as well as the output. Is there any way to stop this?</p>
  
  <p>If I try a similar command, I get all the entries, but still get the <code>echo %a</code> output spamming the results. I don't understand why the following prints all entries, but my attempt on <code>%PATH%</code> doesn't. I suspect I don't understand the <code>/F</code> switch.</p>
  
  <pre><code>Z:\&gt;for %a in (1 2 3) do echo %a
  
  Z:\&gt;echo 1
  1
  
  Z:\&gt;echo 2
  2
  
  Z:\&gt;echo 3
  3
  </code></pre>