如何使批处理文件识别回车键?

时间:2016-07-20 07:03:31

标签: batch-file

我的文件正在进行循环动画,当我按下时,我将其设置为退出循环。如何将1更改为回车键? 这是代码:

choice /c 1c /t 1 /d c >null

if %errorlevel% == 1 goto menu

goto tie

1 个答案:

答案 0 :(得分:0)

Try the keyreader.bat。它会读取一次击键(带有可选的超时)并将其char代码返回到错误级别。 你可以用这个:

call keyreader.bat 1000
if %errorlevel% equ 0 goto :tie
if %errorlevel% equ 13 ( 
   echo enter was pressed
   goto :menu
)