Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find multiple lines with |find in cmd

I'm trying to make a batch file to run the systeminfo command in Windows 7, and narrow down the results to not show the Hot Fix Information - or just some specific lines.

Is there a way to do this without writing out the command multiple times? I.e., right now, I have the following:

systeminfo|find "System Boot Time"

systeminfo|find "Host Name"

systeminfo|find "OS Name"

etc.

The problem with this is it has to reload all the information from the systeminfo cmd for each new line, making it take fairly long. Is it possible to just run the command once and have |find pull up multiple lines?

If not, is it possible to remove information with another command? (I haven't heard of anything like this but not sure it doesn't exist)

like image 1000
Justin Lund Avatar asked Jul 07 '13 15:07

Justin Lund


1 Answers

You can use this:

@ECHO OFF &SETLOCAL
systeminfo|findstr /c:"System Boot Time" /c:"Host Name" /c:"OS Name"

For more information about findstr please look here.

like image 194
Endoro Avatar answered Oct 31 '22 14:10

Endoro