I am trying to execute an application from a batch file by using START command (to hide console when executing) and I need to get errorlevel after execution. For example after System.exit(10) I'd like to restart Java application:
:while
START javaw ...
IF errorlevel 10 GOTO while
But it doesn't work because errorlevel condition is evaluated before the java process has finished.
I've also tested the next code but I get an empty text file because of the same reason:
:while
start javaw ... >exit.txt 2>&1
set /p status=<exit.txt
if "%status%"=="10" goto :while
Then, is there any way to launch a Java application, without console (/WAIT is not an option), and using a loop to restart the app when a problem occurs?