Search code examples
batch-filerapidminer

Check if CTRL-C pressed Or batch wait for agreement


I need to know how can I check in batch file if the second batch file which is opened in other command window has stopped (waiting for argument or process not successful).

@echo off
:loop
start /wait rapidminer-batch.bat -f C:\Users\AHM-PC\Documents\ccc.rmp
echo cmd stopped
pause
goto loop

enter image description here


Solution

  • When called batch ends, it returns a value to errorlevel. It works for call, don't know if for start too.

    if %errorlevel% gtr 0 (
        echo failed
    ) else (
        echo success)
    

    or call exit /b <number of error> in your called batch, to return specific value. Check exit for more details.