我编写了一个简单的 .bat 文件,它会在某一时刻向用户询问是/否问题。现在我想给它添加一个超时时间——比如说 10 秒。有没有简单的方法来做到这一点?
到目前为止我的来源:
SET /P ANSWER=Do you want it (Y/N)?
IF /i {%ANSWER%}=={y} GOTO :yes
IF /i {%ANSWER%}=={yes} GOTO :yes
GOTO :no
:yes
@echo Yeah, it will be done.
GOTO :continue
:no
@echo Nope, it will not happen.
GOTO :continue
:continue
@echo And on we go