Hi, im pretty new to batch , and im not sure if this topic was spoken about Already on this forum. Im not very good at searching. So hear is my question:
is it possible for, for /f to process a command that outputs more then one line?
Here is my example:
For /F "delims=:" %%G in ('systeminfo') do (
set "%%G=%%H"
rem HERE IS WHERE I GET STUCK
)
%%G is going to equal OS NAME and %%H is going to equal AR Coding.
I want for to process all the lines. I want to be able to set all the lines after that also as variables. Is that possible?
For /F to process multiple lines
Moderator: DosItHelp
Re: For /F to process multiple lines
you havent defined the tokens you want to get.
try with
tokens option will assign the string before the first `:` to the %%G and everything else to the %%H
try with
Code: Select all
For /F "tokens=1* delims=:" %%G in (
'systeminfo'
) do (
set "%%G=%%H"
)
Re: For /F to process multiple lines
Thank you so much for the fast reply! I didnt think it was necessary to specify which tokens i want.