Page 1 of 1

How to FIND more than one string?

Posted: 27 Feb 2012 04:15
by tinfanide
I wanna extract two pieces of info, for example,

1. BIOS
2. Computer Name

Two questions (see comments below)
Consider this, please:

criterion.log
BIOS
Computer Name


Code: Select all


@ECHO OFF


:: How can I use
:: TYPE systeminfo >> C:\systeminfo.log

   systeminfo > C:\systeminfo.log

   FOR /F "tokens=* delims=" %%G In (C:\criterion.log) DO (
      :: How can I
                :: TYPE file | FIND string1 string 2 >> newfile
      TYPE C:\systeminfo.log | FIND "%%G" >> C:\extracted.log      

   )

PAUSE



Last question:
How can I do the above task without the for loop in the criterion log?

Re: How to FIND more than one string?

Posted: 27 Feb 2012 04:47
by foxidrive
Use findstr with the /c switch, twice.

Re: How to FIND more than one string?

Posted: 27 Feb 2012 07:19
by tinfanide
Nice one. Thanks.