Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
355 views
in Technique[技术] by (71.8m points)

windows - Uninstall and Install App on my Computer silently

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

No Silver Bullet

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.

General Uninstall

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:

  • HKLMSOFTWAREMicrosoftWindowsCurrentVersionUninstall (64-bit)
  • HKLMSOFTWAREWOW6432NodeMicrosoftWindowsCurrentVersionUninstall (32-bit)
  • HKCUSoftwareMicrosoftWindowsCurrentVersionUninstall (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.


Installer Types & Uninstall (and extract for setup.exe)

  1. "Unattended.com": The easiest and quickest read on the topic of automating install / uninstall could be this one: http://unattended.sourceforge.net/installers.php
    • This is aging content, but I remember it as helpful for me back in the day.
    • And crucially it is not my own content - so I don't link entirely to myself! :-) (most of the links below are earlier answers of mine). Apologizes for that - it is just easier to remember your own content - you know it exists - and it is easier to find.
  2. MSI: The most standardized packages to deal with are MSI packages (Windows Installer).
  3. Setup.exe: Installers in setup.exe format can be just about anything, including wrapped MSI files (Windows Installer). For MSI files wrapped in setup.exe files you can use the previous bullet point's standard mechanisms to uninstall (they are registered by product code GUID). Below are some links on how to extract the content of setup.exe files for various types of setup.exe files and also links to pages documenting the actual setup.exe command line parameters:
  4. Other Tools: There are many tools that can be used to create installers / setup.exe files. Here are some of the bigger ones (just FYI - no command line switches to find here, just product information):
  5. Apps: And there is the whole new world of apps.

Other Links:


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...