I am trying to call a batch file from VBS, but I keep getting this "object required" error:
Line: 4
Char: 1
Error: Object Required: 'wshshell'
Code: 800A01A8
VBS just won't let me call it, no matter what I do. Here is the code I am currently using:
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
The error occurs because you have not created any object named wshshell.
To run a CMD batch file from VBScript:
Dim objShell
Set objShell = WScript.CreateObject("WScript.Shell")
objShell.Run "InSys AntiVirus.bat"