如何检测微软Office的安装版本?微软、版本、Office

2023-09-07 01:18:49 作者:微痞男孩

有谁知道什么是检测已安装的Office版本的最好方法是什么?另外,如果有多个版本的Office安装的,我想知道他们是什么版本。奖金将是如果我能察觉的Excel已安装特定版本(S)(/是)。

Does anyone know what would be the best way to detect which version of Office is installed? Plus, if there are multiple versions of Office installed, I'd like to know what versions they are. A bonus would be if I can detect the specific version(s) of Excel that is(/are) installed.

推荐答案

要检查所安装的Office版本将是检查 InstallRoot 注册表项的Office的一种方式感兴趣的应用程序。

One way to check for the installed Office version would be to check the InstallRoot registry keys for the Office applications of interest.

例如,如果您想检查Word 2007中是否安装了您应检查以下注册表项的presence:

For example, if you would like to check whether Word 2007 is installed you should check for the presence of the following Registry key:

HKLM\Software\Microsoft\Office\12.0\Word\InstallRoot::Path

本条目包含可执行文件路径。

This entry contains the path to the executable.

替换12.0(对于Office 2007)与相应的版本号:

Replace 12.0 (for Office 2007) with the corresponding version number:


Office 97   -  7.0
Office 98   -  8.0
Office 2000 -  9.0
Office XP   - 10.0
Office 2003 - 11.0
Office 2007 - 12.0
Office 2010 - 14.0 (sic!)
Office 2013 - 15.0
Office 2016 - 16.0

其它应用程序也有类似的键:

The other applications have similar keys:

HKLM\Software\Microsoft\Office\12.0\Excel\InstallRoot::Path
HKLM\Software\Microsoft\Office\12.0\PowerPoint\InstallRoot::Path

或者你也可以检查所有应用程序的共同根路径:

Or you can check the common root path of all applications:

HKLM\Software\Microsoft\Office\12.0\Common\InstallRoot::Path

另一种选择,而无需使用特定的注册表项是查询使用 MSIEnumProducts API所描述的这里。

Another option, without using specific Registry keys would be to query the MSI database using the MSIEnumProducts API as described here.

顺便说一句,不同的Office版本并行安装没有正式获得微软的支持。他们有些工作,但你可能会得到意想不到的效果和矛盾。

As an aside, parallel installations of different Office versions are not officially supported by Microsoft. They do somewhat work, but you might get undesired effects and inconsistencies.