title: Modify for loop to not use delayedexpansion in batch script
body: <p>In my efforts to understand the <code>for..do</code> loops syntax and their use of <code>%%</code> variables. I have gone through 2 specific examples/implementations where the one <code>for</code> loop does not use <code>DELAYEDEXPANSION</code> and another where it does use <code>DELAYEDEXPANSION</code> with the <code>!</code> notation. The 1st for loop appears to be compatible with older OSs like the Windows XP whereas the 2nd for loop example does not.</p>
  
  <p><em>Specifically, the <strong>1st for loop</strong> example is taken from this <a href="https://stackoverflow.com/a/44948574/6003691">answer</a> (which is related to <a href="https://stackoverflow.com/a/44929240/6003691">this</a>) and the <strong>2nd for loop</strong> example is taken from this <a href="https://stackoverflow.com/a/19131662/6003691">answer</a></em>. </p>
  
  <p>Modified code for both examples copied below:</p>
  
  <p><strong>1st for loop</strong></p>
  
  <pre><code>for /f "tokens=2 delims==" %%a in ('wmic OS Get localdatetime /value') do set "dt=%%a"
  set "YY=%dt:~2,2%"
  set "YYYY=%dt:~0,4%"
  set "MM=%dt:~4,2%"
  set "DD=%dt:~6,2%"
  set "HH=%dt:~8,2%"
  set "Min=%dt:~10,2%"
  set "Sec=%dt:~12,2%"
  set "datestamp=%YYYY%%MM%%DD%"
  set "timestamp=%HH%%Min%%Sec%"
  echo datestamp: "%datestamp%"
  echo timestamp: "%timestamp%"
  </code></pre>
  
  <p><strong>2nd for loop</strong></p>
  
  <pre><code>SETLOCAL ENABLEDELAYEDEXPANSION
  set "path_of_folder=C:\folderA\folderB"
  
  for /f "skip=5 tokens=1,2,4 delims= " %%a in (
   'dir /ad /tc "%path_of_folder%\."') do IF "%%c"=="." (
    set "dt=%%a"
    set vara=%%a
    set varb=%%b
    echo !vara!, !varb!
    set day=!vara:~0,2!
    echo !day!
  )
  </code></pre>
  
  <p>Since I have been reading and seeing issues where delayed expansion (or the <code>!</code> notation) is not compatible with older OSs (e.g. Windows XP), I would like to see <strong>how to write the 2nd loop like the 1st loop; i.e. without the use of <code>DELAYEDEXPANSION</code></strong>. </p>