Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Exit Code  (Read 2261 times)

0 Members and 1 Guest are viewing this topic.

noggs

  • Guest
Exit Code
« on: September 05, 2006, 10:05:10 AM »
How can I check the exit code/return value from a program being executed in a batch file?

Thanks very much!

Sidewinder



    Guru

    Thanked: 139
  • Experience: Familiar
  • OS: Windows 10
Re: Exit Code
« Reply #1 on: September 05, 2006, 12:24:21 PM »
Try checking the ERRORLEVEL value in reverse sequence. Note that all programs do not issue errorlevels and even Microsoft utilities use them haphazardly. In general a value of zero indicates all is well; anything else is a sign of problems.

Code: [Select]
program
if errorlevel 1 goto problem
if errorlevel 0 goto AOK

:Problem
.
.
goto end

:AOK
echo Everything OK
goto end

:End
The true sign of intelligence is not knowledge but imagination.

-- Albert Einstein