FindStr & Placing output into single value

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
booga73
Posts: 108
Joined: 30 Nov 2011 16:16

FindStr & Placing output into single value

#1 Post by booga73 » 18 Apr 2014 13:10

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

Squashman
Expert
Posts: 4486
Joined: 23 Dec 2011 13:59

Re: FindStr & Placing output into single value

#2 Post by Squashman » 18 Apr 2014 13:13

TOKENS=2 DELIMS=:

booga73
Posts: 108
Joined: 30 Nov 2011 16:16

Re: FindStr & Placing output into single value

#3 Post by booga73 » 18 Apr 2014 13:18

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

Post Reply