调用子错误 800A0414 VBS 时不能使用括号 [英] Cannot use parentheses when calling a Sub Error 800A0414 VBS

查看:30
本文介绍了调用子错误 800A0414 VBS 时不能使用括号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在此脚本的第 7 行和第 12 行收到 800A0414 错误:

I am getting the 800A0414 error in lines 7 and 12 of this script:

Module Module1

  Dim p

    Sub Main()
        CreateObject("Wscript.Shell").Run("program.bat", 0, True)

        p = Process.GetProcessesByName("program")
        If p.Count > 0 Then
            WScript.Sleep(300000)
        Else
            CreateObject("Wscript.Shell").Run("program clean up.bat", 0, True)
        End If

    End Sub

    Private Function WScript() As Object
        Throw New NotImplementedException
    End Function

End Module

我正在尝试运行一个批处理脚本,该脚本启动一个进程,然后等待该进程终止,然后运行另一个批处理脚本.我也不希望显示任何命令框.如果他们的方法更简单,请告诉我.

I am trying to run a batch script, that starts a process, then wait until the process terminates, then run another batch script. I also do not want any command boxes being shown. If their is a easier way please let me know.

感谢您的帮助

推荐答案

当您将过程的参数列表括在括号中时,您必须使用 调用关键字:

When you enclose a procedure's argument list in parentheses, you must use the Call keyword:

Call CreateObject("WScript.Shell").Run("program.bat", 0, True)

如果省略Call关键字,还必须去掉括号:

If you omit the Call keyword, you must also drop parentheses:

CreateObject("WScript.Shell").Run "program.bat", 0, True

这篇关于调用子错误 800A0414 VBS 时不能使用括号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆