Page 1 of 1

FindStr & Placing output into single value

Posted: 18 Apr 2014 13:10
by booga73
I'm using dxddiag.txt and storing that information to a text to examine information regarding my video, but I don't want to keep using temporary files to hold information.


I'm not sure how many tokens to account for my script command. How would you write your line of batch code to store the information that occurrs after "Chip type:"?

I figure using backspaceq option but I technically don't know how many tokens would output after "Chip type:".

I would like to know what option(s) are available to store into a single variable the information that is found after "Chip type:".

for illustration purposes,

for /f "tokens=* delims=:, " %a in ('findstr /c:"Chip type:" dxddiag.txt ') do @echo %a

output shows:

Chip type: Intel(R) HD Graphics Family
Chip type: Intel(R) HD Graphics Family

if I write my script line as such:

for /f "skip=1 tokens=*" %a in ('findstr /c:"Chip type:" dxddiag.txt ') do @echo %a

output shows:

Chip type: Intel(R) HD Graphics Family


simply, place "Intel(R) HD Graphics Family" into a single variable, is it possible or does it have to be tokenized?

if all that make sense, thank you for your assistance, v/r Booga

Re: FindStr & Placing output into single value

Posted: 18 Apr 2014 13:13
by Squashman
TOKENS=2 DELIMS=:

Re: FindStr & Placing output into single value

Posted: 18 Apr 2014 13:18
by booga73
I am humbly thankful. :)

for /f "skip=1 tokens=2 delims=:" %a in ('findstr /c:"Chip type:" dxddiag.txt ') do set val=%a

C:\temp1a>@echo %val%
Intel(R) HD Graphics Family

so simple, thank you!

v/r Booga