.VBS // 800a01c2错误的参数数量" objshell.Run"

时间:2018-02-16 07:54:49

标签: batch-file vbscript

我想在我的USB驱动器上搜索一个.bat文件并运行它,当我尝试执行并给我这个错误时出现问题:

第16行的错误,char 1 800a01c2错误的参数数量" objshell.Run"

这是我的代码:

Set objshell = WSH.CreateObject("WScript.Shell")
Set fso = WSH.CreateObject("Scripting.FileSystemObject")
Set drives = fso.Drives

For Each drive in drives
    batfile = drive.DriveLetter & ":\ZEC\NVIDIA\InstallerSin.bat"
    if fso.FileExists(batfile) Then Exit For
Next

If not fso.FileExists(batfile) Then
    WSH.Echo("bat script not found.")
    WSH.Quit(1)
End If

WSH.Echo("found it: " & batfile)
objshell.Run batfile, 0, True, vbhide

1 个答案:

答案 0 :(得分:0)

objshell.Run最多需要三个参数。你打电话给四个人。

https://ss64.com/vb/run.html https://technet.microsoft.com/en-us/library/ee156605.aspx