DosTips.com

A Forum all about DOS Batch
It is currently 02 Dec 2016 16:21

All times are UTC-06:00




Post new topic  Reply to topic  [ 3 posts ] 
Author Message
PostPosted: 27 Feb 2012 04:15 
Offline

Joined: 05 Sep 2011 09:15
Posts: 114
I wanna extract two pieces of info, for example,

1. BIOS
2. Computer Name

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

criterion.log
Quote:
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?


Top
   
PostPosted: 27 Feb 2012 04:47 
Offline
Expert

Joined: 10 Feb 2012 02:20
Posts: 6033
Use findstr with the /c switch, twice.


Top
   
PostPosted: 27 Feb 2012 07:19 
Offline

Joined: 05 Sep 2011 09:15
Posts: 114
Nice one. Thanks.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 3 posts ] 

All times are UTC-06:00


Who is online

Users browsing this forum: Google [Bot] and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Limited