My dept runs a script to uninstall unwanted software. Here’s what I want to do. I can generate a list of installed software using the wmic command. How can I compare those lists to make sure the software I want to remove has been removed. Essential compare the lists and if a software I don’t want is in both enable a certain label.
I.e.
list 1 has mcafee
list 2 has mcafee
lblinstalled.enabled=true
list 1 has mcafee
list 2 does not
lblinstalled.enabled=false
A simple brute force way is myArray.IndexOf. It returns the first index a value appears in the array, or -1 if not found. So if the index is >= 0 the value is in the array, otherwise not.
for i As integer = 0 to list1.Ubound
if list2.IndexOf( list1(i) ) >= 0 then
//list2 has list1(i)
else
//list2 doesn't have list1(i)
end
next
Awesome, next question. I’ve gotten the data into a list but it’s the 3rd word of each line that I need. Any thoughts on how to get that 3rd word of each line?