I am trying to call a batch file from VBS, but I keep getting this "object required" error:
我试图从VBS调用批处理文件,但我不断收到“需要对象”错误:
Line: 4
Char: 1
Error: Object Required: 'wshshell'
Code: 800A01A8行:4个字符:1个错误:需要对象:'wshshell'代码:800A01A8
VBS just won't let me call it, no matter what I do. Here is the code I am currently using:
无论我做什么,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
1 个解决方案
#1
2
The error occurs because you have not created any object named wshshell.
发生此错误是因为您尚未创建任何名为wshshell的对象。
To run a CMD batch file from VBScript:
从VBScript运行CMD批处理文件:
Dim objShell
Set objShell = WScript.CreateObject("WScript.Shell")
objShell.Run "InSys AntiVirus.bat"
#1
2
The error occurs because you have not created any object named wshshell.
发生此错误是因为您尚未创建任何名为wshshell的对象。
To run a CMD batch file from VBScript:
从VBScript运行CMD批处理文件:
Dim objShell
Set objShell = WScript.CreateObject("WScript.Shell")
objShell.Run "InSys AntiVirus.bat"