找回密码
 加入
搜索
查看: 2157|回复: 8

VISTA系统如何用WMI获取IE的版本呢?

[复制链接]
发表于 2009-1-17 19:44:11 | 显示全部楼层 |阅读模式
vista_home用下面WMI代码不能获取IE的版本号,XP 是可以获取得到的
$strComputer = "."
$objWMIService = ObjGet("winmgmts:\\" & $strComputer &"\root\cimv2\Applications\MicrosoftIE")
$colIESettings = $objWMIService.ExecQuery("Select * from  MicrosoftIE_FileVersion")
For $strIESetting in $colIESettings
        MsgBox(1,"IE",$strIESetting.Version )
        ExitLoop
Next

虽然也可以用注册表获取,但还是想通过WMI 来获取。

[ 本帖最后由 auto 于 2009-1-18 09:21 编辑 ]
发表于 2009-1-17 19:45:24 | 显示全部楼层
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet   Explorer
 楼主| 发表于 2009-1-17 20:03:46 | 显示全部楼层
注册表的方法知道,
用WMI在VISta 下获取DNS(第二个)也会出错
貌似比较多的WMI在VISTA下都会出错

[ 本帖最后由 auto 于 2009-1-17 20:05 编辑 ]
发表于 2009-1-17 20:29:22 | 显示全部楼层
请查询VISTA下的WMI用法。可能部分参数已经更新,所以不适用了的。
没装有VISTA系统,无法判断。
 楼主| 发表于 2009-1-17 20:38:26 | 显示全部楼层
请查询VISTA下的WMI用法。可能部分参数已经更新。。。
请问在哪查询?
WMI的用法是参考WMI生成器和脚本专家的
发表于 2009-1-18 00:11:23 | 显示全部楼层

$str = DllStructCreate("dword;dword;dword;dword;dword")
DllStructSetData($str, 1, DllStructGetSize($str))
DllCall("Shlwapi.dll","long","DllGetVersion","ptr",DllStructGetPtr($str))
MsgBox(64,"IE版本是:",DllStructGetData($str,2)&"." & _
                                           DllStructGetData($str,3)&"." & _
                                           DllStructGetData($str,4))

评分

参与人数 1金钱 +10 贡献 +5 收起 理由
auto + 10 + 5 我很赞同

查看全部评分

 楼主| 发表于 2009-1-18 09:08:33 | 显示全部楼层
原帖由 sanhen 于 2009-1-18 00:11 发表
[au3]
$str = DllStructCreate("dword;dword;dword;dword;dword")
DllStructSetData($str, 1, DllStructGetSize($str))
DllCall("Shlwapi.dll","long","DllGetVersion","ptr",DllStructGetPtr($str))
MsgBox(64, ...

嗯..还可以通过API获取啊,虽然不能获取"修正号"后面号码,
但是主版本号和次版本号和修正号都有了,问题基本解决

[ 本帖最后由 auto 于 2009-1-18 09:11 编辑 ]
发表于 2009-10-21 00:55:39 | 显示全部楼层
本帖最后由 文傲 于 2009-10-21 00:57 编辑

方法1,从exe文件
$version = FileGetVersion(@ProgramFilesDir & "\Internet Explorer\iexplore.exe")
MsgBox(0, "IE Version", "Your IE version is: " & $version)

方法2,从注册表
$ie_ver = RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer", "Version")

原文
http://www.autoitscript.com/forum/index.php?showtopic=4036
发表于 2011-1-27 19:03:17 | 显示全部楼层
本帖最后由 ghl781258 于 2011-8-23 20:44 编辑


;;;;获取IE版本号:4种方法
方法1和方法4,在winxp+IE8.0环境下不能获得正确浏览器版本号.

_fangfa4()

Func _fangfa1()
$str = DllStructCreate("dword;dword;dword;dword;dword")
DllStructSetData($str, 1, DllStructGetSize($str))
DllCall("Shlwapi.dll","long","DllGetVersion","ptr",DllStructGetPtr($str))
MsgBox(64,"IE版本是:",DllStructGetData($str,2)&"." & _
                                           DllStructGetData($str,3)&"." & _
                                           DllStructGetData($str,4))
EndFunc


Func _fangfa2()
        $version = FileGetVersion(@ProgramFilesDir & "\Internet Explorer\iexplore.exe")
        MsgBox(0, "IE Version", "Your IE version is: " & $version)
EndFunc

Func _fangfa3()
        $ie_ver = RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer", "Version")
        MsgBox(0, 'IE Version', $ie_ver)
EndFunc

Func _fangfa4()
        $strComputer = "."
        $objWMIService = ObjGet("winmgmts:\\" & $strComputer &"\root\cimv2\Applications\MicrosoftIE")
        $colIESettings = $objWMIService.ExecQuery("Select * from  MicrosoftIE_FileVersion")
        For $strIESetting in $colIESettings
                        MsgBox(1,"IE",$strIESetting.Version )
                        ExitLoop
        Next
EndFunc

您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-10-2 16:30 , Processed in 0.078750 second(s), 20 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表