Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: IntControl 64 exit code getexitcode error level errorlevel
Does WinBatch have any feature similar to the DOS "errorlevel" that works in the desired manner? I can use LastError() to get the last internal WinBatch error code, but I cannot seem to get the exit code for external programs that are launched by WinBatch.
IntControl 64 gets the exit code returned by the last program run. This function gets the exit code (also known as the "errorlevel") that was returned by the program that was most-recently run using RunWait (or using RunShell with the @WAIT flag specified). If no program has been run, or if the last-run program was not run in @WAIT mode, this function will return 99999.
RunWait('c:\sample.bat', '') exitcode = IntControl (64, 0, 0, 0, 0)
Also you can use the RunShell function with the @GETEXITCODE wait flag.
RunShell('c:\sample.bat', '', '', @NORMAL, @GETEXITCODE)If the @GETEXITCODE parameter is used, the exit code of an application that is launched with the RunShell function will be returned. This is the same as specifying @WAIT, except that on success the function will return the exit code of the application that was launched.
Article ID: W12976
Filename: How to Check Exit Status Code of Program.txt
File Created: 2013:01:08:15:19:20
Last Updated: 2013:01:08:15:19:20