I assigned each line to a repeating var1,var2 and so on, in this line set var!count!=%%H.
However, I am unable to code this for loop for /f "tokens=1" %%S in (!tempvar!) do ( to properly accept the correct value of var1 (var2..var3..).
echoing !var1! will output the first line of cmd's output correctly. Hence, I also tried !var!count2!! and var!count2! as parameters but it doesn't work.
Any help is appreciated, cheers
Code: Select all
@echo off setlocal enabledelayedexpansion set /a count=0 set cmd="command-to-be-run" for /f "delims=" %%H in ('!cmd!') do ( set /a count+=1 set var!count!=%%H ) set /a count2=0 for /L %%Z in (1,1,!count!) do ( set /a count2+=1 set tempvar=var!count2! for /f "tokens=1" %%S in (!tempvar!) do ( echo do something here ) )