如何在 Windows 7 中查找已安装应用程序的 UpgradeCode 和 ProductCode
我的机器上安装了一个应用程序。我也有它的源代码,但不知何故该应用程序的 ProductCode 和 UpgradeCode 被更改了。
现在我想获取此已安装应用程序的 UpgradeCode 和 ProductCode。我觉得必须有一些工具可以做到这一点。
谁能告诉我如何获取已安装应用程序的 UpgradeCode 和 ProductCode?
I have an application installed on my machine. I also have its source code but somehow the ProductCode and UpgradeCode of this application were changed.
Now I want to get the UpgradeCode and ProductCode of this installed application. I feel there must be some tool for this.
Can anyone kindly let me know how to get the UpgradeCode and ProductCode of an installed application?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(11)
如果有人想获取已安装的应用程序包代码,只需在命令提示符中使用您的应用程序名称执行以下命令即可。您将获得产品代码和包装代码。
wmic 产品,其中“Name like '%YOUR_APPLICATION_NAME%'”获取 IdentityingNumber、PackageCode
If anyone wants to get installed application package code, just execute below command with your application name in the command prompt. You will be getting product code along with package code.
wmic product where "Name like '%YOUR_APPLICATION_NAME%'" get IdentifyingNumber, PackageCode
另一种过于复杂的解决方法,其优点是不必像以前的解决方法所要求的那样重新安装应用程序。这要求您有权访问 msi(或嵌入 msi 的 setup.exe)。
如果您有 Visual Studio 2012(或可能其他版本)并安装免费的“InstallShield LE”,则可以使用 InstallShield 创建新的安装项目。
“组织您的设置”步骤中的配置选项之一称为“升级路径”。打开升级路径的属性,在左侧窗格中右键单击“升级路径”并选择“新升级路径”...现在浏览到 msi(或包含 msi 的 setup.exe)并单击“打开”。升级代码将在您现在应该看到的右侧窗格的设置页面中填充。
Another way-too-complicated workaround, with the benefit of not having to re-install the application as the previous workaround required. This requires that you have access to the msi (or a setup.exe with the msi embedded).
If you have Visual Studio 2012 (or possibly other editions) and install the free "InstallShield LE", then you can create a new setup project using InstallShield.
One of the configuration options in the "Organize your Setup" step is called "Upgrade Paths". Open the properties for Upgrade Paths, and in the left pane right click "Upgrade Paths" and select "New Upgrade Path" ... now browse to the msi (or setup.exe containing the msi) and click "open". The upgrade code will be populated for you in the settings page in the right pane which you should now see.
在看到 Yan Sklyarenko 的 解决方法(当前)。但是,如果您/其他人能找到一种方法(至少)从 MSI 中查找 UpgradeCode 和 ProductCode,请继续阅读。
来自 http://www.dwarfsoft.com/ blog/2010/06/22/msi-package-code-fun/,修改为允许(使用
wscript.exe
启动时)每个 MSI 弹出一个信息框(在 1023 处截断)字符,由于wscript.echo
限制);能够从 GUI 和 CLI 输入 MSI;一些基本的人类输入验证;删除了调试代码('Set oDatabase)和 1 个错误修复(DB.OpenView)。参考文献:
http://msdn.microsoft.com/en-我们/库/aa369794%28VS.85%29.aspx
http://www.eggheadcafe.com/forumarchives/platformsdkmsi/Jan2006/post25948124。 asp
如果需要在弹出窗口中复制并粘贴任何 GUID,我倾向于发现使用后续输入框最简单,例如
inputbox "","",MSIDetails
Hadn't found any way of finding out the UpgradeCode from an installed application, before seeing Yan Sklyarenko's workaround (currently) above. But if you/anyone else would find a way of finding out (at least) both UpgradeCode and ProductCode from a MSI, read on.
From http://www.dwarfsoft.com/blog/2010/06/22/msi-package-code-fun/, modified to allow (when launched with
wscript.exe
) one popup box of info per MSI (Trunicated at 1023 chars, due towscript.echo
limitation); able to input MSI(s) from the GUI as well as the CLI; some basic human input validation; removed debug code (' Set oDatabase) and 1 bug fix (DB.OpenView).References:
http://msdn.microsoft.com/en-us/library/aa369794%28VS.85%29.aspx
http://www.eggheadcafe.com/forumarchives/platformsdkmsi/Jan2006/post25948124.asp
If one needs to copy&paste any of the GUID's in the popup, I tend to find it easiest to use a subsequent inputbox, like
inputbox "","",MSIDetails
如果您没有 msi 并且需要升级代码,而不是产品代码,那么答案就在这里:如何在 C# 中找到已安装应用程序的升级代码?
If you don't have the msi and you need the upgrade code, rather than the product code then the answer is here: How can I find the upgrade code for an installed application in C#?
重要:自从这个答案最初发布以来已经有一段时间了,聪明的人想出了更明智的答案。检查我该如何找到已安装的 MSI 文件的升级代码? 如果您需要可靠且全面的方法,请来自 @ Stein Åsmul。
这是另一种方法(您不需要任何工具):
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
键(如果是 64 位计算机上的 32 位安装程序,则可能位于HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows \CurrentVersion\Uninstall
代替)。您停止的 GUID 是 ProductCode。
现在,如果您确定重新安装此应用程序会顺利进行,您可以运行以下命令行:
这将“修复”您的应用程序。现在查看日志文件并搜索“UpgradeCode”。该值被转储到那里。
注意:只有当您确定重新安装流程正确实施并且这不会破坏您已安装的应用程序时,您才应该执行此操作。
IMPORTANT: It's been a while since this answer was originally posted, and smart people came up with wiser answers. Check How can I find the Upgrade Code for an installed MSI file? from @ Stein Åsmul if you need a solid and comprehensive approach.
Here's another way (you don't need any tools):
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
key (if it's a 32-bit installer on a 64-bit machine, it might be underHKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall
instead).This GUID you stopped on is the ProductCode.
Now, if you're sure that reinstallation of this application will go fine, you can run the following command line:
This will "repair" your application. Now look at the log file and search for "UpgradeCode". This value is dumped there.
NOTE: you should only do this if you are sure that reinstall flow is implemented correctly and this won't break your installed application.
返回结果需要一些时间,很容易需要几十秒,但是 wmic 效果很好,可以编写脚本:
结果:
IdentifingNumber
是 ProductCode。我没有看到 UpgradeCode 的属性,但也许它可能隐藏在其他内容下。请参阅 http://quux.wiki.zoho.com/WMIC-Snippets.html 对于许多其他示例,包括卸载:有关 UpgradeCode,请参阅 如何找到已安装 MSI 文件的升级代码?
It takes some time to return results, easily many tens of seconds, but wmic works well and can be scripted:
result:
The
IdentifingNumber
is the ProductCode.I didn't see a property for UpgradeCode, but perhaps it might be buried under something else.See http://quux.wiki.zoho.com/WMIC-Snippets.html for many other examples, including uninstall:For UpgradeCode see the excellent and detailed answer to How can I find the Upgrade Code for an installed MSI file?
对于所有使用者:
您应该知道,这将在 PC 上安装的每个 MSI 应用程序上运行自我修复。如果您要检查 eventvwr,它会说它已完成每个产品的重新配置。
在这种情况下,我使用以下方法(Yan Sklyarenko 方法的混合):
现在,如果您输入:
您将得到以下信息:
如果您的组织在安装应用程序时使用 MST 负载,您将希望避免运行自我修复包他们恢复一些关键设置。
To everyone using:
You should be aware that this will run a self-heal on every single MSI application installed on the PC. If you were to check eventvwr it will say it has finished reconfiguring each product.
In this case i use the following (a mixture of Yan Sklyarenko's method):
Now if you were to type:
You would be given the following:
If your organization uses loads of MST's whilst installing applications you would want to avoid running self-heals encase they revert some crucial settings.
如果您有 msi 安装程序,请使用 Orca(Microsoft 的工具)打开它,表属性(行升级代码、产品代码、产品版本等)或表升级列升级代码。
尝试通过注册表查找安装程序:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall 找到所需的子项并观察值InstallSource。也许在此过程中您将能够找到 MSI 文件。
If you have msi installer open it with Orca (tool from Microsoft), table Property (rows UpgradeCode, ProductCode, Product version etc) or table Upgrade column Upgrade Code.
Try to find instller via registry: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall find required subkey and watch value InstallSource. Maybe along the way you'll be able to find the MSI file.
Powershell 相当方便地处理这样的任务:
然后您也可以使用它来获取卸载信息:
Powershell handles tasks like this fairly handily:
You can then use it to get the uninstall information as well:
您可以使用 MsiEnumProductsEx 和 MsiGetProductInfoEx 方法枚举系统上所有已安装的应用程序并将数据与您的应用程序相匹配
You can use the MsiEnumProductsEx and MsiGetProductInfoEx methods to enumerate all the installed applications on your system and match the data to your application
在使用 PowerShell 5 的 Windows 10 预览版中,我可以看到您可以执行以下操作:
不熟悉甚至不确定是否所有产品都有 UpgradeCode,但是
根据这篇文章您需要从此注册表路径搜索 UpgradeCode:不幸的是,注册表项值是 ProductCode,注册表项是 UpgradeCode。
In Windows 10 preview build with PowerShell 5, I can see that you can do:
Not familiar with even not sure if all products has UpgradeCode, but
according to this postyou need to search UpgradeCode from this registry path:Unfortunately, the registry key values are the ProductCode and the registry keys are the UpgradeCode.