我正在尝试将 VBS 脚本一起用作启动脚本以卸载 Silverlight(如果它的版本低于 5),但我的代码在尝试比较值时不断给我一个类型不匹配。
版本为 5.1.10411.0。如何将此值与整数值进行比较?
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_Product WHERE Caption = 'Microsoft Silverlight'")
Dim item
For each item in colItems
prodVer = item.Version
Next
If prodVer < 5 Then
set WshShell = CreateObject("WScript.Shell")
set oExec = WshShell.Exec("wmic product where caption='Microsoft Silverlight' call uninstall")
End If