1

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

Cœur
  • 37,241
  • 25
  • 195
  • 267
AHMED ABID
  • 13
  • 4

2 Answers2

0

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.

Peter Badida
  • 11,310
  • 10
  • 44
  • 90
0

The normal method to provide interbatch communication is a flag file

Either you create a flag file in the main routine and wait for the started routine to delete it or wait until the started batch creates a file, and delete it.

eg

echo.>myflag.txt
start anotherbatch.bat
:loop
timeout /t 1 >nul
if exist myflag.txt goto loop

Here, the batch will wait until myflag.txt is deleted, which you do in the second batch. All you need is for the two routines to agree on a filename to use.

Magoo
  • 77,302
  • 8
  • 62
  • 84