Reputation: 21
I am looking for a script or some cmd command to uninstall any app from my computer. I am using Windows OS. Being an automation analyst I have to constantly run automated tests for different products whenever there is new build. So every time I have to uninstall and install build which takes time.
I did try the following command:
wmic product where name="product name" call uninstall
Apparently it did work, but it didn't remove the app from control panel and also when I tried to install again it shows installation menu saying uninstall is needed. However the app's data is removed from installation directory.
Upvotes: 2
Views: 7572
Reputation: 42126
There is no silver bullet when it comes to automating installation or uninstallation - but there is a quick trick that is described in the "General Uninstall" section.
There are heaps of different flavors of installer types - and the list keeps growing. Automating them is a bit of a black art as you will be fully aware of. Not rocket science, but tedious and tiresome when things don't work reliably and there is no suitable remedy that consistently works all the time.
I have written about these issues many times before and cross-linked the content very heavily. It is messy, but if you follow the links and web of linked pages below you should be able to find the information you need for many different setup.exe and installer types.
Before going into the below ad-hoc list of different types of installers / uninstallers and how to handle their command line parameters. I want to add that you can find a list of most of the products installed on the system in these registry locations:
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
(64-bit)HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall
(32-bit)HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall
(per-user)By checking for UninstallString
or equivalent for a specific entry under these parent keys, you can get a general idea of how to uninstall the product in question by command line.
Try this simple approach first, but do read the material below for a better understanding of how installers of various kinds operate. Not all deployment tools and deployment operations register properly in these locations.
Apps are not found in these locations in the registry, only MSI installers (Windows Installer) and some - or most - of legacy setup.exe installers.
msiexec.exe
command line (section 3 in the linked answer). Do read this answer please. It shows the diverse ways Windows can invoke an install / uninstall for MSI files (command line
, automation
, Win32
, .NET
, WMI
, Powershell
, etc...)setup.exe
command line parameters:
setup.exe
files with WiX. I only know of this "unofficial list" of switches to link to. The basic uninstall format is: setup.exe /uninstall /passive /norestart
setup.exe /?
to get a list of parameters for WiX (and other) setup.exe
files.Other Links:
Upvotes: 1
Reputation: 21
I figured it out myself and it works for many projects which have .exe setups. Following is the format 1. Open terminal with admin rights 2. go to path in where setup that you used to install the product. 3. Once there then type: setupname.exe /uninstall /q
Upvotes: 0