在我的电脑上静默卸载和安装应用程序 [英] Uninstall and Install App on my Computer silently

查看:49
本文介绍了在我的电脑上静默卸载和安装应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一个脚本或一些 cmd 命令来从我的计算机上卸载任何应用程序.我正在使用 Windows 操作系统.作为一名自动化分析师,每当有新版本时,我必须不断地为不同的产品运行自动化测试.所以每次我必须卸载和安装构建时都需要时间.

我确实尝试了以下命令:

wmic product where name="product name" 调用卸载

显然它确实有效,但它没有从控制面板中删除该应用程序,而且当我再次尝试安装时,它显示安装菜单说需要卸载.但是,应用程序的数据已从安装目录中删除.

解决方案

No Silver Bullet

在自动安装或卸载方面没有灵丹妙药 - 但有一个快速技巧,在常规卸载"部分中进行了描述.>

有许多不同风格的安装程序类型——而且这个列表还在不断增加.正如您将完全意识到的那样,自动化它们有点像黑色艺术.不是火箭科学,而是当事情不能可靠地工作并且没有始终有效的合适补救措施时乏味和令人厌烦.

我之前就这些问题写过很多篇文章,并且对内容进行了大量交叉链接.它很乱,但如果您点击下面的链接和链接页面,您应该能够找到许多不同 setup.exe 和安装程序类型所需的信息.

一般卸载

在进入下面的特殊列表之前,不同类型的安装程序/卸载程序以及如何处理它们的命令行参数.我想补充一点,您可以在这些注册位置中找到系统上安装的大多数产品的列表:

  • HKLMSOFTWAREMicrosoftWindowsCurrentVersionUninstall(64 位)
  • HKLMSOFTWAREWOW6432NodeMicrosoftWindowsCurrentVersionUninstall(32 位)
  • HKCUSoftwareMicrosoftWindowsCurrentVersionUninstall(每用户)

通过检查这些父键下特定条目的 UninstallString 或等效项,您可以大致了解如何通过命令行卸载相关产品.

首先尝试这种简单的方法,但请阅读以下材料以更好地了解各种安装程序的操作方式.并非所有部署工具和部署操作都在这些位置正确注册.

在注册表中的这些位置找不到

应用,只有MSI 安装程序(Windows 安装程序)和一些(或大部分)旧的setup.exe 安装程序.

<小时>

安装程序类型和卸载(并提取 setup.exe)

  1. Unattended.com":关于自动化安装/卸载主题的最简单、最快捷的阅读方式可能是:http://unattended.sourceforge.net/installers.php
    • 这是陈旧的内容,但我记得它对当时的我很有帮助.
    • 最重要的是,它不是我自己的内容 - 所以我不会完全链接到我自己!:-)(下面的大部分链接都是我之前的回答).对此表示歉意 - 记住你自己的内容更容易 - 你知道它存在 - 而且更容易找到.
  2. MSI:要处理的最标准化的包是 MSI 包(Windows 安装程序).
  3. Setup.exe:setup.exe 格式的安装程序几乎可以是任何东西,包括打包的 MSI 文件(Windows 安装程序).对于包装在 setup.exe 文件中的 MSI 文件,您可以使用前一个要点的标准机制进行卸载(它们由产品代码 GUID 注册).下面是一些关于如何为各种类型的 setup.exe 文件提取 setup.exe 文件的内容的链接以及指向记录实际 setup 的页面的链接.exe 命令行参数:
  4. 其他工具:有许多工具可用于创建安装程序/setup.exe文件.以下是一些较大的(仅供参考 - 此处没有命令行开关,只有产品信息):
  5. 应用:还有全新的应用世界.

<小时>

其他链接:

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.

解决方案

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:

这篇关于在我的电脑上静默卸载和安装应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆