【问题标题】:Calling a batch script from a vbscript script从 vbscript 脚本调用批处理脚本
【发布时间】:2015-10-15 01:13:46
【问题描述】:

我正在尝试从 VBS 调用批处理文件,但我不断收到此“需要对象”错误:

行:4
字符:1
错误:需要对象:“wshshell”
代码:800A01A8

VBS 就是不让我调用它,无论我做什么。这是我目前使用的代码:

X=MsgBox("Scan For Malware?",vbYesNo,"InSYS AntiVirus")
if x=6 Then

wshshell.run "InSys AntiVirus.bat"

End if

if x=7 Then
wscript.quit

end if

【问题讨论】:

    标签: batch-file vbscript call


    【解决方案1】:

    发生错误是因为您尚未创建任何名为 wshshell 的对象。

    从 VBScript 运行 CMD 批处理文件:

    Dim objShell
    Set objShell = WScript.CreateObject("WScript.Shell")
    objShell.Run "InSys AntiVirus.bat"
    

    来源:http://ss64.com/vb/syntax-run.html

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-05-17
      • 1970-01-01
      • 2014-12-03
      • 2020-06-05
      • 2011-06-15
      相关资源
      最近更新 更多