1

Example, to see if KB983590 is installed:

systeminfo | find "KB983590"

But what if I wanted to find out if more then one KB was installed?

jscott
  • 24,484
  • 8
  • 79
  • 100
MathewC
  • 6,957
  • 9
  • 39
  • 53

4 Answers4

2

Try this:

systeminfo | findstr "KB"

You can also use /i for case insensitive searching. Run findstr /? for even more options.

If you want to search for just a subset of patches, use spaces in between entries:

systeminfo | findstr "KB958488 KB976902 KB976932"
jftuga
  • 5,731
  • 4
  • 42
  • 51
1

You can use a line like this:

FOR /F "usebackq tokens=5 delims= " %i IN (`netstat -ano ^|find "ESTABLISHED"`) DO @tasklist /fi "pid eq %i" | find "%i"

or, a bit shorter, this does the same:

netstat -a -b -n -o | findstr ESTABLISHED || tasklist | findstr PID
kenlukas
  • 3,101
  • 2
  • 16
  • 26
0

You could also join multiple commands using &&

setlocal
set USERNAME=rbrown
net user %USERNAME% /domain | Find /i "Full Name" && net user %USERNAME% /domain | Find /i "Password expires"
endlocal

Full Name                    Richard Brown
Password expires             8/04/2021 9:32:54 am
0

I'd go the route of 'find' instead of 'findstr' (simpler/easier)

systeminfo | find /I "kb"

you'll get your list.

use for /f to organize the data easier such as

for /f "tokens=2* delims= " %F IN ('systeminfo ^| find /I "kb"') DO ECHO %F%G%H

that will get rid of the numbered sequence from the beginning of each line.

if you want only the KB#####, change the tokens value to only 2 without the asterisk, and change the ending ECHO to just ECHO %F

for /f "tokens=2* delims= " %F IN ('systeminfo ^| find /I "kb"') DO ECHO %F%G%H>>"%USERPROFILE%\desktop\systeminfo.txt"

will throw it on your desktop as a .TXT file

of course if you want it ina batch file, make sure your %F has an extra % (%%F)

Anthony Miller
  • 457
  • 3
  • 6
  • 19