Java 如何从 Windows 注册表中获取 IE 版本号?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4211686/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-14 14:37:16  来源:igfitidea点击:

How to get the IE version number from the Windows registry?

javawindowsinternet-explorerregistryversion-numbering

提问by Andrew Swan

My Java application needs to know what version of IE (if any) is installed on the local machine, and querying the registry seems like the easiest way. What registry key and value should I look up?

我的 Java 应用程序需要知道本地机器上安装了哪个版本的 IE(如果有),查询注册表似乎是最简单的方法。我应该查找什么注册表项和值?

This needs to work on Windows XP, Windows Server 2003, and later.

这需要在 Windows XP、Windows Server 2003 和更高版本上运行。

采纳答案by jrun1

Stumbled across this while trying to solve the same problem.

在尝试解决同样的问题时偶然发现了这一点。

Andrew's answer from 2010 is correct, but since then, newer Internet Explorers (10 and 11) do not show their true version number in the registry value: 'Version'. Instead, it is recorded in the registry value: 'svcVersion'.

Andrew 在 2010 年的回答是正确的,但从那时起,较新的 Internet Explorer(10 和 11)不会在注册表值中显示其真实版本号:“版本”。相反,它记录在注册表值中:“svcVersion”。

回答by Andrew Swan

Reading this key using the "reg query" OS command:

使用“reg query”操作系统命令读取此密钥:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer

... with this value:

...具有此值:

Version

Returns a number like this:

返回一个这样的数字:

8.0.7600.16385

Or returns errorCode 1 if that entry does not exist, which presumably indicates that IE is not installed.

或者,如果该条目不存在,则返回 errorCode 1,这可能表示未安装 IE。

回答by Krzysztof Gapski

In newer version IE 10 and 11 true version is recorded in value 'svcVersion'and value 'Version'contains at the beginning '9.'

在较新版本的 IE 10 和 11 中,真实版本记录在值'svcVersion' 中,值'Version'包含在开头的 ' 9.'