Windows Batch FOR loop : <p>I'm trying to write a batch script that would loop through each line from the output of another command. I am having trouble getting it to work. This is one example:</p>

<blockquote>
  <p>FOR %i in ('wmic useraccount get name') DO ECHO %i</p>
</blockquote>

<p>The command <strong>wmic useraccount get name</strong> gives me a list of users each on a separate line. What am I doing wrong? Thanks.</p>
