@ECHO OFF
SET CWD=%~dp0
PUSHD .
CD %CWD%
IF "%1" == "" GOTO CHOICE

:EXECUTE_SCRIPT
COLOR 1E
ECHO Executing %1
CALL %CWD%\PlatformSimulator\run.bat --batch "%1"
GOTO END

:CHOICE
SET TESTDIR=%CWD%\TestEnvironment\scripts
SET SCRIPT_LIST_FILE=%TMP%\script_list.txt
IF EXIST %SCRIPT_LIST_FILE% DEL /F /Q %SCRIPT_LIST_FILE% 
FOR /F %%i in ('dir /B %TESTDIR%\GRIFO*.py') do ECHO   %%~ni >> %SCRIPT_LIST_FILE%
FIND /N /V "" %SCRIPT_LIST_FILE%
SET /P CHOICE=Select number : 
SET /A SKIP=-1
SET /A  SKIP += %CHOICE%
IF %SKIP% EQU -1 GOTO ERROR
ECHO %SKIP%
FOR /F %%i in ('MORE +%SKIP% %SCRIPT_LIST_FILE%') DO (
  CALL %0 %TESTDIR%\%%i.py
  GOTO END 
)

:ERROR
COLOR C0
ECHO ERROR : Missing script file as batch argument 
REM Aspetta 2 secondi
CHOICE /d 1 /c 1 /t 2 /N

:END

COLOR
POPD