title: Batch file FOR /f tokens
body: <p>Can anyone please explain exactly how the following code works, line by line. I'm really lost. I've been trying to learn how to use the FOR command but I don't understand this.</p>
  
  <pre><code>@echo off
  
  for /f "tokens=* delims= " %%f in (myfile) do (
    set line=%%f
    call :processToken
    )
    goto :eof
  
  :processToken
  
    for /f "tokens=1* delims=/" %%a in ("%line%") do (
    echo Got one token: %%a
    set line=%%b
    )
    if not "%line%" == "" goto :processToken
    goto :eof
  </code></pre>