1.bat:
@echo off
@set curDerectory=%~dp0
php.exe "%curDerectory%1.php"
1.php:
<?php
$arr = ['dev','pro'];
foreach($arr as $i=>$v){
echo "[$i] $v \n";
}
echo "\n Your choice [0-" . (count($arr) - 1) . ', or "q" to quit] ';
$answer = trim(fgets(STDIN));
if(!empty($arr[$answer])){
echo $arr[$answer];
}
?>
执行结果: