cmd echo all, except lines that contains. (whitelist software that is ok, but output non-whitelisted)
Ola gents,
We created some batch to find all installed programs on workstations.
we would like to filter out a whitelist, and echo the non-whitelisted.
For instance....Filter out all software that contains:
"Security"
"Microsoft"
"ESET"
enz. enz.
And echo the software that isn't whitelisted.
All help is appreciated.
Thanx in advance.
setlocal enabledelayedexpansionfor /f "tokens=*" %%i in ('reg query HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall /s ^|findstr /R "\<DisplayName"') do ( set /a cl+=1 set softw_!cl!=%%i )for /l %%i in (1, 1, %cl%) do ( set softw_%%i=!softw_%%i:~19! echo !softw_%%i! )
As always... it works as requested.
Better then expected too !
Thanx ..(again)
It looks so easy... :)
Grtz
Bill Prew
Just to offer a slightly different (and maybe faster?) approach (I couldn't resist), how about this approach?
Basic idea is get the list of installed software products into a text file ALL.TXT, then use FINDSTR to display only the lines that are not in the software.txt file.
http://www.computerhope.com/if.htm
IF string1==string2 (
#Next If check) ELSE (
echo string)