静默卸载并在我的计算机上安装App [英] Uninstall and Install App on my Computer silently
问题描述
我正在寻找脚本或某些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.
- "Unattended.com" :自动化安装/卸载主题的最简单快捷的阅读方式可能是: http://unattended.sourceforge.net/installers.php
- 这是陈旧的内容,但我记得它对我有帮助.
- 至关重要的是,这不是我自己的内容-所以我不会完全链接到我自己! :-)(以下大多数链接是我的较早答案).对此表示歉意-记住您自己的内容会更容易-您知道它的存在-而且更容易找到.
- "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.
- 它们可以通过多种可靠的方式进行安装/卸载: 许多与以前的安装技术相比,具有重要意义的公司收益 . 标准化的命令行和可抑制的GUI以实现可靠的安装/卸载是最重要的两个优点.
- 标准msiexec .exe命令行
- 如何我可以找到已安装的MSI设置的产品GUID吗?
- 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?
- 常规链接 :此处有一些有关如何处理不同类型的setup.exe文件的信息: 其中包含有关Installshield setup.exe的特性在这里
- 以下是Installshield setup.exe文件的官方文档
- 这里是对Installshield setup.exe文件的setup.exe提取的简单说明
- General Links: There is some information on how to deal with different types of setup.exe files here: Extract MSI from EXE
- Installshield: is a tool used to create setups of both legacy and modern MSI types. It delivers setup.exe files that are actually in many different formats and some with differing command line switches.
- There is a description of Installshield setup.exe peculiarities here
- Here is the official documentation for Installshield setup.exe files
- Here is a simple explanation of setup.exe extraction for Installshield setup.exe files
- WiX安装程序可以采用标准的Windows Installer格式,例如 MSI , MSP 等.在这种情况下,请使用列出的选项在项目要点2中进行处理.
- 还有一种使用WiX编译
setup.exe
文件的方法. .基本卸载格式为:setup.exe /uninstall /passive /norestart
- 您还可以打开命令提示符并进入
setup.exe /?
以获取WiX(和其他)setup.exe
文件的参数列表. - 还有一个WiX工具,可用于反编译MSI文件和解压缩WiX setup.exe文件.请参阅此处的相关部分:如何比较两个(或多个)MSI文件的内容?
- WiX installers can be in standard Windows Installer format such as MSI, MSP, etc... In this case use the options listed in bullet point 2 to deal with them.
- There is also a way to compile
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
- You can also open a command prompt and go
setup.exe /?
to get a list of parameters for WiX (and other)setup.exe
files. - There is also a WiX tool that can be used to decompile MSI files and also to decompress a WiX setup.exe file. See relevant section here: How can I compare the content of two (or more) MSI files?
- 非MSI安装程序工具: http://www.installsite.org/pages /en/tt_nonmsi.htm
- Windows安装程序工具: http://www.installsite.org/pages /en/msi/authoring.htm
- 用于部署的系统管理工具: http://www.installsite. org/pages/en/msi/admins.htm
- 这可能也有帮助: Wix-如何在没有UI的情况下运行/安装应用程序
- Non-MSI installer tools: http://www.installsite.org/pages/en/tt_nonmsi.htm
- Windows installer tools: http://www.installsite.org/pages/en/msi/authoring.htm
- Sys-admin tools for deployment: http://www.installsite.org/pages/en/msi/admins.htm
- This may also be of help: Wix - How to run/install application without UI
- 如何以静默方式安装UWP appx?
- How to silent install an UWP appx?
- Add-AppxPackage
- Remove-AppxPackage
其他链接:
Other Links:
这篇关于静默卸载并在我的计算机上安装App的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
- How to silent install an UWP appx?