从 vbscript 脚本调用批处理脚本

Calling a batch script from a vbscript script

我正在尝试从 VBS 调用批处理文件,但我一直收到此 "object required" 错误:

Line: 4
Char: 1
Error: Object Required: 'wshshell'
Code: 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

出现错误是因为您还没有创建任何名为wshshell.

的对象

到 运行 来自 VBScript 的 CMD 批处理文件:

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

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