Is it possible to retrieve (programatically) the exit code of a Windows task?

399 Views Asked by At

I am running a task from inside a batch file like this:

schtasks /run /tn TASK_NAME

The task, in turn, executes another batch file, that may exit with an error code thus:

exit -1

Is there any way to get the exit code of the task that completed?

1

There are 1 best solutions below

2
On

I think ERRORLEVEL might be what you're looking for: http://www.robvanderwoude.com/errorlevel.php