title: Batch - Store command output to a variable (multiple lines)
body: <p>I know a way of doing this which is a bit like cheating but the code below creates a temporary file and then deletes it. I don't want that happen. So is there a proper or better way of doing it?</p>
  
  <pre><code>command 2&gt;&gt; "temp"
  set /p OUTPUT=&lt;"temp"
  del "temp"
  echo %OUTPUT%
  </code></pre>
  
  <p>I know there is a solution which uses for loop but that doesn't work for commands which return more than one line of result. I want to store all of them into my variable. (I tried this <a href="https://stackoverflow.com/questions/16203629/batch-assign-command-output-to-variable/16203904#16203904">code</a> btw)</p>