title: Batch file set wmi output as a variable
body: <p>Hello having my first go with a BATCH script, I'm getting the size of the HDD as follow:</p>
  
  <pre><code>wmic diskdrive get size
  </code></pre>
  
  <p>Which works fine but I'd like to store this value into a variable for later use, such as using ECHO to display the value.</p>
  
  <p>I'm not sure how I set the output of the above command to a variable. I went with:</p>
  
  <pre><code>SET hddbytes=wmic diskdrive get size
  </code></pre>
  
  <p>But this just sets the variable to the above text string and not the output.</p>