error level
What exactly are error level codes? are they the same as exit codes? and where can I find information on either of them?
At this moment I'm clueless...
Windows Forum
What exactly are error level codes? are they the same as exit codes? and where can I find information on either of them?
At this moment I'm clueless...
errorlevel codes are responses that executables return to the shell when they complete and operation. The exact values are determined by the programmer, however, one value is typically universal - 0 (however not always)
A zero value usually meanssuccess, if you can find info on other values from the supplier of the code it can be quite useful to determine the results of a command you give. If you play around with echoing out the %errorlevel% value upon ececution you can often determine other level code values.
A common shell command in script is
IF ERRORLEVEL GTR 1 GOTO somewhere
This usually means a greater than 0 exit code was supplied and therefore some type of error occurred.
Errorlevel codes are mostly used in Shell scripts.
by eduncan50
by klatta
Errorlevels: see batch commands, environment variables, command.com.
Error levels can be set by a batch or .cmd file; they give you a way to branch in your program logic based on the type of error that is returned. They are similar to a programsexit codes and return 0 as a default to indicate no errors. You can set the error level based on the users action or other event. Say you had a Yes-No prompt, you might set errorlevel=1 if the user enters a "Y" or "y", and errorlevel=2 if the user enters "N" or "n". You would then branch based on whether the user entered yes or know (i.e., if the "asking" batch file returns 1 or 2 as the error level. The error level gets set as an environment variable and can be tested by other programs.
by eduncan50
by eduncan50
This discussion is closed to new replies.
Sort by Trending