2016-05-13 8 views
0

プログラム終了時に何も入力しなかった場合、ユーザーが何かを入力するのを待つバッチでプログラムを作ることは可能でしょうか?はいの場合はどうですか?バッチポーズすべてのキーが終了するのを待つ

+6

http://stackoverflow.com/questions/17359345/timeout-for-user-decision-in-windows-batch-fileを与えます –

答えて

1

これを試してみてください:

choice /c [your key(s)][any different key] /n /d [2nd key] /t 10>nul 
if %errorlevel% equ 1 (do stuff here) 
if %errorlevel% equ 2 exit /b 

/選択を使用してみてください?詳細については、

0

はそれに打撃

@echo off 

choice /t 10 /c ynr /cs /d r /m "Do you want it (Y/N)?" 
if errorlevel 3 exit 
if errorlevel 2 goto :no 
if errorlevel 1 goto :yes 

:yes 
@echo You typed yes 
GOTO :continue 

:no 
@echo You typed no 
GOTO :continue 

:continue 
@echo And on we go 

pause 
関連する問題