Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR BASIC

dos assign command output to variable (when output is of multiple lines)

SETLOCAL ENABLEDELAYEDEXPANSION
SET count=1
FOR /F "tokens=* USEBACKQ" %%F IN (`command`) DO (
  SET var!count!=%%F
  SET /a count=!count!+1
)
ECHO %var1%
ECHO %var2%
ECHO %var3%
ENDLOCAL
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #dos #assign #command #output #variable #output #multiple
ADD COMMENT
Topic
Name
2+7 =