简体   繁体   English

我可以从我的程序中启动MSI安装程序吗?

[英]Can I launch my MSI installer from my program?

I'd like users to be able to reconfigure their installation (turn components on/off) by clicking a button on the UI. 我希望用户能够通过单击UI上的按钮来重新配置其安装(打开/关闭组件)。 This would launch the installer using the msiexec /i command (or equivalent), and would have the same effect as clicking 'Change' in the Programs & Features Windows dialog. 这将使用msiexec /i命令(或等效命令)启动安装程序,并且与在“程序和功能Windows”对话框中单击“更改”具有相同的效果。

I have one potential way of doing this: Install a copy of the MSI and use that to trigger the installation wizard. 我有一种可能的方法: 安装MSI的副本并使用它来触发安装向导。

However, I'm wondering if I can locate and trigger the MSI installer wizard using the registry or some other method, rather than making a copy of the installer. 但是,我想知道我是否可以使用注册表或其他方法找到并触发MSI安装程序向导,而不是制作安装程序的副本。 Is this possible? 这可能吗?

Uninstall information is stored in HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\<your app> , where <your app> is a name or a GUID (depending on your installation). 卸载信息存储在HKEY_LOCAL_MACHINE \\ SOFTWARE \\ Microsoft \\ Windows \\ CurrentVersion \\ Uninstall \\ <您的应用>中 ,其中<您的应用>是一个名称或GUID(取决于您的安装)。 Under your app's key, the ModifyPath value should hold the modification command - msiexec.exe /I ... or so. 在您的应用程序密钥下, ModifyPath值应该包含修改命令 - msiexec.exe /I ...左右。

You can call msiexec /i <ProductCode> and it will figure out the rest. 您可以调用msiexec /i <ProductCode> ,它将找出其余部分。 You would need to store your product code somewhere - you could easily add an entry into the Registry table of your MSI which uses [ProductCode] as the value. 您需要将产品代码存储在某个位置 - 您可以轻松地将条目添加到MSI的Registry表中,该表使用[ProductCode]作为值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM