Q. How can I handle errors in VBScript?

Error handling is off by default in VBScript. When an error is encountered, the script halt.

You can enable error handling by including the On Error resume next statement, and you can turn it off by including On Error Goto 0.

When error handling is enabled, the script continues to run.

You can test for an error with statements like:

if err.number0 then 
    wscript.echo err.number, err.description
    err.clear
end if 


Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish