Alex Rivera | Logout

What does the "On Error Resume Next" statement do?

Asked 2010-02-04T20:18:21.680
77

I came to some VBScript examples, and I saw the statement On Error Resume Next basically at the beginning of the script.

What does it do?

Edit
Report

1 Answer

53

It's worth noting that even when On Error Resume Next is in effect, the Err object is still populated when an error occurs, so you can still do C-style error handling.

On Error Resume Next

DangerousOperationThatCouldCauseErrors

If Err Then
    WScript.StdErr.WriteLine "error " & Err.Number
    WScript.Quit 1
End If

On Error GoTo 0
answered 2010-02-05T15:49:37.637

Your Answer