WMIC in cmd file

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
jheibeck
Posts: 2
Joined: 02 Nov 2012 09:57

WMIC in cmd file

#1 Post by jheibeck » 02 Nov 2012 10:15

When I use wmic product where "name like 'java%'" call uninstall /nointeractive it works fine and uninstalls all versions of java.

However, when I place the same command in a cmd file, when run it prints to the cmd window wmic product where "name like 'java'" call uninstall /nointeractive.

Notice the % sign is missing but nothing else is changed. Therefore only some versions of java are removed.

Any idea why this is happening?

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: WMIC in cmd file

#2 Post by foxidrive » 02 Nov 2012 10:21

If the percent is legal syntax then in a batch file it needs to be doubled to %%

jheibeck
Posts: 2
Joined: 02 Nov 2012 09:57

Re: WMIC in cmd file

#3 Post by jheibeck » 02 Nov 2012 10:26

Thank you. That solved the problem.

Post Reply