Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Running WMIC from within .bat fails?

3,576 views
Skip to first unread message

joshc

unread,
Nov 4, 2009, 9:22:21 PM11/4/09
to
I have a simple WMIC command that utilises a wild card search.

wmic product where "name like 'Infocouncil%'" call uninstall

When running this directly from a command prompt it works fine. However if I run the same command from within a .bat file it fails to find an instance of the product.

Now if I remove the wildcard search in the bat file it works fine:

wmic product where name="Infocouncil_5_3_19_0_" call uninstall

Any ideas?

Every

EggHeadCafe - Software Developer Portal of Choice
Dr. Dotnetsky's Cool .NET Tips & Tricks #15
http://www.eggheadcafe.com/tutorials/aspnet/639b4eef-1f75-4039-99a4-d74c89548125/dr-dotnetskys-cool-net.aspx

Tom Lavedas

unread,
Nov 4, 2009, 10:08:18 PM11/4/09
to
> Dr. Dotnetsky's Cool .NET Tips & Tricks #15http://www.eggheadcafe.com/tutorials/aspnet/639b4eef-1f75-4039-99a4-d...

Need to escape percent signs, which are normal parsed in batch files.
This should work ...

wmic product where "name like 'Infocouncil%%'" call uninstall
_________________
Tom Lavedas

tohighga...@gmail.com

unread,
Sep 10, 2012, 7:51:39 AM9/10/12
to
Hi,
Tom is right but If there are more than one products installed for "InfoCouncil" it will uninstall only the first one it finds.

I am using a query in my batch file but instead of returning all the products it just gives me one.

WMIC product where "name like 'Adobe%%'" get name

I can see in my add remove programs that I have Adobe Reader, Adobe Flash Player and Adobe Shockwave Player but I am only getting Adobe Reader.
0 new messages