Reading from a csv file and extracting certain data columns based on first column value

前端 未结 4 580
情书的邮戳
情书的邮戳 2021-02-08 03:45

This is my first batch program and I have been searching online but still struggling to write up a solution.

I have the following CSV file:

\"RH\",2013/0         


        
4条回答
  •  终归单人心
    2021-02-08 04:21

    You need to enable delayed expansion:

    @echo off
    
    setlocal EnableDelayedExpansion
    
    set "_InputFile=..."
    
    for /f "tokens=1-18* delims=," %%A in (%_InputFile%) do (
      Set _var1=%%A
      Set _var2=%%B
      ...
    
      if "!_var1!"=="RH" echo !_var2!
    )

提交回复
热议问题