如何以编程方式查找 Windows 中已安装应用程序的安装位置
我想以编程方式查找基于 MSI 的安装的安装位置。该应用程序不会在注册表的卸载项中记录安装位置。应用程序不填充 ARPINSTALLLOCATION 属性。 (这与“添加/删除程序”引用并存储在“卸载”密钥中的值相同)。但是卸载仍然可以找到它所在的位置并可以将其卸载。这些信息存储在哪里? Windows 使用缓存的 MSI 安装程序来卸载应用程序,但安装位置是在安装时首次确定的,因此此信息不是安装程序包的一部分。
I want to find the installed location for an MSI based installation programmatically. The app does not make an entry of Install Location in the uninstall key in the registry. Application does not populate ARPINSTALLLOCATION property. (This is the same value that is referred by Add/Remove Program and is stored in Uninstall key). However uninstall still finds where it is located and can uninstall it. Where is this information stored? Windows uses a cached MSI installer for uninstalling the application however Install Location is determined for the first time while installing so this information is not part of the installer package.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我假设当您说“安装位置”时,您真正的意思是“应用程序的 EXE 位于哪个目录?”否则,这个问题是不明确的,因为 MSI 不一定必须安装“应用程序”。它可以安装没有 EXE 的组件。它可以跨多个目录安装它...
但这可能会起作用:
调用 MsiGetProductInfo 获取 ARPINSTALLLOCATION。您需要知道安装时的“产品名称”。 to 作为第一个参数。调用 MsiEnumProducts 枚举所有已安装的“产品”(如果需要)
I assume when you say "install location", you really mean "what directory is the EXE of the application located at?" Otherwise, the question is ambiguous because an MSI doesn't necessarily have to install an "application". It could install a component that has no EXE. And it can install it across multiple directories...
But this will likely work:
Call MsiGetProductInfo to get the ARPINSTALLLOCATION. You will need to know the "product name" as it is installed by. to as the first param. Call MsiEnumProducts to enumerate all the installed "products" if needed
下面是使用
WindowsInstaller.Installer
COM 接口的 VBScript 版本:从 http://msdn.microsoft.com/en-us/library/windows/desktop/aa369432(v=vs. 85).aspx#methods
Here's a VBScript version that uses the
WindowsInstaller.Installer
COM interface:Find out more about the Installer object from http://msdn.microsoft.com/en-us/library/windows/desktop/aa369432(v=vs.85).aspx#methods