静默卸载并在我的计算机上安装App [英] Uninstall and Install App on my Computer silently

查看:130
本文介绍了静默卸载并在我的计算机上安装App的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找脚本或某些cmd命令来从计算机上卸载任何应用程序.我正在使用Windows操作系统.作为自动化分析师,无论何时有新版本,我都必须不断对不同产品进行自动化测试.因此,每次我必须卸载并安装构建时都需要花费时间.

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.

我已经多次写过关于这些问题的文章,并且非常紧密地交叉链接了内容.这很麻烦,但是如果您点击下面的链接和链接页面的网络,则应该能够找到许多不同的setup.exe和安装程序类型所需的信息.

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位 )
  • HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall( 32位 )
  • HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall( 每用户 )

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

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.

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

应用 .

Apps are not found in these locations in the registry, only MSI installers (Windows Installer) and some - or most - of legacy setup.exe installers.

  1. "Unattended.com" :自动化安装/卸载主题的最简单快捷的阅读方式可能是: http://unattended.sourceforge.net/installers.php
    • 这是陈旧的内容,但我记得它对我有帮助.
    • 至关重要的是,这不是我自己的内容-所以我不会完全链接到我自己! :-)(以下大多数链接是我的较早答案).对此表示歉意-记住您自己的内容会更容易-您知道它的存在-而且更容易找到.
  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.
  • They can be installed / uninstalled in a plethora of reliable ways: Uninstalling an MSI file from the command line without using msiexec. The most common approach is to use the 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...)
  • Though complicated Windows Installer has a number of corporate benefits of major significance compared to previous installation technologies. Standardized command line and suppressible GUI for reliable install / uninstall are two of the most important benefits.
  • The standard msiexec.exe command line
  • How can I find the product GUID of an installed MSI setup?
查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆