title: Loop through CSV file with batch - Space issue
body: <p>I have a csv file like this</p>
  
  <pre><code>name,sex,age
  venu,m,16
  test,,22
  </code></pre>
  
  <p><strong>[EDIT]</strong><br>
  name could have comma also</p>
  
  <pre><code>"venu,gopal",m,16
  </code></pre>
  
  <p>I want to handle if sex is nothing and save it to another file. </p>
  
  <p>I have a script like this</p>
  
  <pre><code>@Echo Off
  For /F "usebackq tokens=1-3  delims=," %%a in (test.csv) Do (
     echo %%a, %%b, %%c &gt;&gt; test-new.csv
  )
  </code></pre>
  
  <p>But for the third record, I am getting %%b as 22 which should be space. How to fix this?</p>
  
  <p><strong>[EDIT2]</strong></p>
  
  <p>I have tried as per that link. I am not sure what I am doing wrong. I am getting same issue. Please check it once.</p>
  
  <pre><code>@echo off
  setlocal DisableDelayedExpansion
  
  For /F "usebackq tokens=1-3 delims=" %%x in (C:\somefile.csv) Do (
  
      setlocal EnableDelayedExpansion
      set "var=%%x"   
  
      set "var=!var:"=""!"
      set "var=!var:^=^^!"
      set "var=!var:&amp;=^&amp;!"
      set "var=!var:|=^|!"
      set "var=!var:&lt;=^&lt;!"
      set "var=!var:&gt;=^&gt;!"
      set "var=!var:,=^,^,!"
      set var=!var:""="!
      set "var=!var:"=""Q!"
      set "var=!var:,,="S"S!"
      set "var=!var:^,^,=,!"
      set "var=!var:""="!"
      set "var=!var:"Q=!"
  
  
      For /F "tokens=1-3  delims=," %%a in ("!var:"S"S=","!") Do (
        endlocal
        echo %%~a, %%~b, %%~c
        setlocal EnableDelayedExpansion
        pause
      )
  
      endlocal
  
  )
  </code></pre>