excel - Using batch to find data in .csv and use output to continue batch -
i use batch retrieve first 2 letters of computer name (e.g. 'nl') , set %country%
.
what use %country%
search in .csv file in column (eg 'a7'). when batch has found information, has return column b (eg 'b7') , set %adv%
.
@echo off :home setlocal enabledelayedexpansion set csvfile=c:\users\username\desktop\test2.csv set country=%computername:~0,2% :findit /f "tokens=*" %%a in (%csvfile%) ( set inline=%%a /f "tokens=1-2 delims=," %%1 in ("!inline!") ( set "area=%%~1" & set "adv=%%~2" goto :showres ) ) :showres echo %adv% pause
Comments
Post a Comment