不同的软件,判断方法不一致。如果是activeX控件
IsObject(CreateObject("Adobe.SVGCtl"))
Adobe.SVGCtl是progid一般软件安装后,在注册表中有一定的表示,可以从注册表中判断
IsObject(CreateObject("Adobe.SVGCtl"))
Adobe.SVGCtl是progid一般软件安装后,在注册表中有一定的表示,可以从注册表中判断
调试欢乐多
var strComputer = ".";
var intcount = 0 ;
var objWMIService = WScript.GetObject("winmgmts:" + "\\" + strComputer + "\\" + "root" + "\\" + "cimv2");
var colSoftware = objWMIService.ExecQuery ("Select * from Win32_Product Where Name = 'COM Explorer'");
for (objSoftware in colSoftware){
document.write ( objSoftware.name );
document.write ( objSoftware.Description );
intcount = intcount + 1;
}
document.write ( intcount );
</script>你自己稍微改下。
这个需要把ie安全级别改为最低,允许执行匿名activeX, name替换为你的Installer 的名称。
要看有那些属性msdn查看win32_Product .
如果有计数则说明有此程序安装上。当然你也可以不用这个,用注册表操作,查看是否有安装。
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = 'Notepad.exe'")
For Each objProcess in colProcessList
objProcess.Terminate()
Next
</script>你看看你用这个vbscript代码会不会报错。
strComputer = "."
intcount = 0
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colSoftware = objWMIService.ExecQuery ("Select * from Win32_Product where name='Vbsedit' ")
For Each objSoftware In colSoftware
document.write ( "Name: " )
document.write ( objSoftware.name )
document.write ( " " )
document.write ( "Description: " )
document.write ( objSoftware.Description )
document.write ( "<br>" )
intcount = intcount + 1
Next
document.write ( intcount )
</script>
<script language="javascript">
var bControlLoaded=false;
function window.onload()
{
try
{
if (objectID.someMethod)
bControlLoaded = true;
}
catch (ex)
{}
alert(bControlLoaded);
}
</script>
<object id="objectID"></object>
用VBS函数CreateObject("progid"))能创建一个对象。
然后用IsObject函数判断是不是一个对象。
下面这个例子,是判断svg插件是否安装的
Function isSVGControlInstalled()
on error resume next
isSVGControlInstalled = IsObject(CreateObject("Adobe.SVGCtl"))
end Function