title: Why does for /f not ignore blank lines?
body: <p>I'm trying to get a simple value from a <code>for /f</code> loop in a batch file. </p>
  
  <p>Using the command <code>wmic path win32_localtime get dayofweek</code> gives me the output:</p>
  
  <pre><code>C:\sendemail&gt;wmic path win32_localtime get dayofweek
  DayOfWeek
  1
  
  
  C:\sendemail&gt;
  </code></pre>
  
  <p>So, using the following batch script, I should be able to return a result of "1":</p>
  
  <pre><code>set cmd=wmic path win32_localtime get dayofweek
  for /f "tokens=1 skip=1" %%Z in ('%cmd%') do set _myday=%%Z
  echo Var is %_myday%
  </code></pre>
  
  <p>But I don't, it sets the variable at least twice, as seen here :</p>
  
  <pre><code>C:\sendemail&gt;set cmd=wmic path win32_localtime get dayofweek
  
  C:\sendemail&gt;for /F "tokens=1 skip=1" %Z in ('wmic path win32_localtime get dayofweek') do set _myday=%Z
  
  C:\sendemail&gt;set _myday=1
  
   :\sendemail&gt;set _myday=
  
  C:\sendemail&gt;echo Var is
  Var is
  
  C:\sendemail&gt;
  </code></pre>
  
  <p>At first, I wondered why, then I realised the loop is processing the two blank lines... which it shouldn't be. according to this: <a href="http://ss64.com/nt/for_cmd.html" rel="noreferrer">http://ss64.com/nt/for_cmd.html</a></p>
  
  <blockquote>
    <p>Skip SKIP will skip processing a number of lines from the beginning of
    the file. SKIP includes empty lines, but after the SKIP is complete,
    FOR /F ignores (does not iterate) empty lines.</p>
  </blockquote>
  
  <p>Either, it's not working normally, or those lines are not blank, and are filled with something...</p>
  
  <p>At any rate, how do I get just the day of the week result out of this, and ignore the rest?</p>