Uninstall programs from windows command line

by admin on June 6, 2011

Sometimes we will have to uninstall a  program or software in automated way which does not require any user interaction. We can use wmic product command in such scenarios. Below you can find the syntax and also few examples.

Below is the command we need to use to uninstall a program.

wmic product where "description='program name' " uninstall

Note that you need to provide accurate program name along with the version if it’s part of the program name. wmic product get lists all the installed programs in the command prompt. You can use findstr command in combination with wmic command.

Below are few examples for uninstalling different programs.

Uninstall Java SDK/JDK from command prompt

First you need to find the version of the Java installed on the system.

C:\>wmic product get description | findstr /C:"Java"
Java SE Development Kit 7 Update 79 (64-bit)
Java SE Development Kit 8 Update 45 (64-bit)
Java Auto Updater

I have above versions of JDK on my system. Let’s say we want to uninstall ‘Java 7 Update 79 (64-bit)’

C:\WINDOWS\system32>wmic product where "description='Java SE Development Kit 7 Update 79 (64-bit)'" uninstall
Executing (\\mypc\ROOT\CIMV2:Win32_Product.IdentifyingNumber="{64A3A4F4-B792-11D6-A78A-00B0D0170790}",Name="Java SE Development Kit 7 Update 79 (64-bit)",Version="")->Unin
Method execution successful.
Out Parameters:
instance of __PARAMETERS
        ReturnValue = 0;

Uninstall MySql server from command prompt

You can use the below command to install Mysql server 5.5

 wmic product where "description='MySQL Server 5.5' " uninstall

For example to get the program name for mysql you can use the below command.

wmic product get | findstr /I /C:mysql

Uninstall web folders

wmic product where "description='WebFldrs XP'" uninstall

This wmic command should be run from eleavated administrator command prompt. Otherwise, it throws up an error like below.

c:\>wmic product where "description='Java 7 Update 79 (64-bit)'" uninstall
Executing (\\mypc\ROOT\CIMV2:Win32_Product.IdentifyingNumber="{26A24AE4-039D-4CA4-87B4-2F06417079FF}",Name="Java 7 Update 79 (64-bit)",Version="7.0.790")->Uninstall()
Method execution successful.
Out Parameters:
instance of __PARAMETERS
        ReturnValue = 1603;

If you get the error No Instance(s) Available, it means that there’s no such product installed on your system. Double check if you have got the product description accurately.

c:\>wmic product where "description='Java SE Development Kit 7 Update 79 (64-bit)'" uninstall
No Instance(s) Available.

{ 3 comments… read them below or add one }

Dz February 26, 2012 at 8:29 pm

You forgot to write, that WMIC shows information only about products installed by .msi installer.


Bill November 1, 2014 at 11:32 pm

C:\WINDOWS\system32>wmic [enter]
‘wmic’ is not recognized as an internal or external command, operable program, or batch file

From Windows XP Home edition SP3


Manish March 29, 2015 at 10:25 am

I am not able to uninstall some programs eg. opera and etc using either control panel or cmd prompt. Plz help mr out here and sugest some ways. Thanx


Leave a Comment

Previous post:

Next post: