中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-13 13:08
47,811 topics / 349,897 posts / today 0 new / 48,256 members
DOS学习入门 & 精彩文章 (教学室) » Question about batch files
Printable Version  694 / 2
Floor1 wphs0326 Posted 2004-03-23 00:00
银牌会员 Posts 509 Credits 1,708 From 安徽淮南
How do I write a batch file that exits when ESC is pressed, and continues when any key is pressed?
Floor2 Kinglion Posted 2004-03-23 00:00
铂金会员 Posts 1,924 Credits 5,798 From 金獅電腦軟體工作室
The following is quoted from wphs0326 on 2004-3-23 0:03:59:
How do I write a batch file that exits when ESC is pressed, and continues when any key is pressed?


@echo off
ECHO Please choose A. Continue executing this batch file ESC. Exit this batch file
INKEY 99 A98 a97
IF ERRORLEVEL 99 GOTO END
IF ERRORLEVEL 98 GOTO GO

:GO
ECHO Continue executing the program
GOTO OK

:END
ECHO Exit the program

:OK

The INKEY.COM file used by the program and the batch file example:
Open attachment
Floor3 wphs0326 Posted 2004-03-23 00:00
银牌会员 Posts 509 Credits 1,708 From 安徽淮南
Thanks!!
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023