嘿,伙计们,我知道这听起来可能很愚蠢,但我脑子里一直有这个问题……我对这个 wscript 或 vbscripting 真的很陌生……在撰写本文时,我想出了如何使用 wscript 打开 IE .. .这是代码
Set WshShell = WScript.CreateObject("WScript.Shell")
Return = WshShell.Run("iexplore.exe www.bbc.co.uk", 1)
但我不知道如何检查是否安装了firefox,然后打开firefox,如果安装了chrome,打开chrome,所有浏览器类型都一样.....
更新:
我做了一些研究,想为什么不检查注册表,所以我想出了这个检查注册表的脚本,现在我不知道为什么,但这总是给出相同的输出“密钥不存在”事件虽然我有这个我系统中的注册表
keyTest = keyExists("HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla\Mozilla Firefox")
If keyTest = False Then
wscript.echo "Key does not exist"
Elseif keyTest = True then
wscript.echo "Key exists"
End if
Function keyExists (RegistryKey)
If (Right(RegistryKey, 1) <> "\") Then
RegistryKeyExists = false
Else
On Error Resume Next
WshShell.RegRead RegistryKey
Select Case Err
Case 0:
keyExists = true
Case &h80070002:
ErrDescription = Replace(Err.description, RegistryKey, "")
Err.clear
WshShell.RegRead "HKEY_ERROR\"
If (ErrDescription <> Replace(Err.description, _
"HKEY_ERROR\", "")) Then
keyExists = true
Else
RegistryKeyExists = false
End If
Case Else:
keyExists = false
End Select
On Error Goto 0
End If
End Function