...
- If a native Windows program or script (.bat, .cmd) causes an error then this will assign the exit code to the
$Global:LastExitCode
$LastExitCode
global variable. This behavior does not apply to cmdlets causing errors. - JobScheduler checks this variable and will set the job exit code accordingly. For exit codes != 0 an error is raised.
- This behavior is superior compared to shell jobs as errors from any line in the job script are detected. For shell scripts only the last line of a job script determines the execution result (Unix:
$?
, Windows:%ERRORLEVEL%
).
...