@echo off

set TM_FTP_EXT=0
set TM_RANK_EXT=0

if "%TM_FTP_EXT%" == "1" ( start "tm_save_ftp" /MIN tm_save_ftp_start.bat )
if "%TM_RANK_EXT%" == "1" ( start "tm_gery_rank" /MIN tm_gery_rank_start.bat )

:start_TMgery 

"C:\wamp\bin\php\php5.2.6\php.exe" tm_gery.php
if %ERRORLEVEL% EQU 1 goto fin
if %ERRORLEVEL% EQU 2 goto def

echo "TM GERY crashed... restart..." 

goto start_TMgery 

:def

pause

:fin