: バッチファイルによるメニューサンプル : copyright: 池部 元 : date: 2010-02-28 @echo off :start mode con cols=80 lines=25&color f1 cls title バッチメニューサンプル echo 【バッチメニュー】 by Ikebe echo [a] Aの確認後実行 echo [b] Bの即実行 echo [c] Cの即実行 echo [x] バッチ終了 set choice= set /p choice=実行したいキーを押し、Enterキー: echo. if not '%choice%'=='' set choice=%choice:~0,1% if /i '%choice%'=='a' goto check_a if /i '%choice%'=='b' goto execute_b if /i '%choice%'=='c' goto execute_c if /i '%choice%'=='x' goto exit goto start :check_a echo 実行しますか? echo [1] 実行する echo [2] キャンセル set index= set /p index=実行したいキーを押し、Enterキー: echo. if not '%index%'=='' set index=%index:~0,1% if "%index%"=="1" goto execute_a if "%index%"=="2" goto start goto a :execute_a echo Aです。 pause goto start :execute_b echo Bです。 pause goto start :execute_c echo Cです。 pause goto start :exit : DOSプロンプトから起動したときのために色を元に戻します color cls