Tutorials

What is ERRORLEVEL in Windows?

When a process or application finishes in Windows, its exit code can help indicate whether it encountered an error. In the batch-file example below, that value is displayed using %ERRORLEVEL%.

A value of 0 generally represents successful completion, but interpreting a result requires knowing what the particular command or application reports.

The original Notepad example

The Spanish article illustrates this using a BAT file that opens Notepad, displays %ERRORLEVEL% after the application is closed manually, and pauses so the result can be read:

notepad
ECHO %ERRORLEVEL%
Pause

The result shown

The original example displays:

0

The author interprets that value as Notepad having closed without an error in that example. This translation preserves the original commands and result; it is not a new test of Notepad's launch or exit behaviour on every Windows version. Test the behaviour of the specific application before relying on it in an automated process.

Editorial responsibility: Todo sobre informática.

Comments (0)

Comments are shown in their original language.

No comments have been published yet. Be the first to join the conversation.

Add a public comment

Your email is optional and will not be published. Comments are reviewed before they appear.

We will only use it to let you know if we reply.