VBscript 800a0414错误和脚本安装更新

时间:2012-03-16 13:24:09

标签: vbscript

我对vbs相当新,我正在编写一个脚本来检查安装了什么版本的程序,并在必要时更新它。我在文件夹中有更新,它检查(或应该)kbnumber和标题以确保其正确更新。

我一直在下面一行收到错误代码800a0414,我已经到处寻找并尝试了多种方法来放置括号,将它们带走或使用呼叫。

Else InStr(1, update.title, "Internet Explorer 8", vbtextcompare) > 0 Then
        Installed = installHotFix(ie9RegExp)

此外,如果你能看到这个并帮助我,我无法判断它是否会起作用,因为编译器会遇到上述问题。一旦800a0414解决了,我不想用另一个问题充斥网站。我提前谢谢你。

Set ie7RegExp = "^IE7.*strKBNumber.*"
Set ie8RegExp = "^IE8.*strKBNumber.*"
Set ie9RegExp = "^IE9.*strKBNumber.*"

If InStr(1, update.title, "Internet Explorer", vbtextcompare) > 0 Then
    If InStr(1, update.title, "Internet Explorer 6", vbtextcompare) > 0 Then
            Installed = installHotFix(ie7RegExp)
            myRegExp = ie7RegExp

    ElseIf InStr(1, update.title, "Internet Explorer 7", vbtextcompare) > 0 Then
            Installed = installHotFix(ie8RegExp)
            myRegExp = ie8RegExp

    Else InStr(1, update.title, "Internet Explorer 8", vbtextcompare) > 0 Then
            Installed = installHotFix(ie9RegExp)
            myRegExp = ie9RegExp

Function installKB(strKBNumber)

Dim myRegExp

myRegExp.IgnoreCase = True
myRegExp.Pattern = strKBNumber
installHotFix(myRegExp)

End Function

Function installHotFix(objRegExp)

Dim result
Dim hotfixDir

installKB = false

For each hotfixdir in arrHotfixlocations
    if objFSO.FolderExists(hotfixDir) Then
        result = SearchForHotfixes(objRegExp, hotfixDir)
        if result = True Then
            installKB = True
        End If
    End If
Next
End Function

Function SearchForHotfixes(objRegExp, strFolderName)
Dim file
Dim subFolder
dim result

SearchForHotfixes = false

For Each file in objFSO.GetFolder(strFolderName).Files
   If objRegExp.Test(file.name) Then
        installUpdate(file)
        SearchForHotfixes = true
   End If
Next

For Each subFolder in objFSO.GetFolder(strFolderName).subFolders
    result = SearchForHotfixes(objRegExp, subFolder)
    If result = true then
        SearchForHotfixes = true
    End If
Next

End Function

这只是我已经改变的部分,在我添加上面的旧脚本工作之前。因此,如果您需要更多代码或更好的解释来帮助我,请询问,但我相信这就是全部。

1 个答案:

答案 0 :(得分:1)

Else InStr(...

随后您进行逻辑测试时应ElseIfInStr(1, update.title, "Internet Explorer 8", vbtextcompare) > 0

如果您想要与之前elseif所需的任何内容相匹配,那么

Else
    Installed = installHotFix(ie9RegExp)
    myRegExp = ie9RegExp