呵呵,我的重启50次的猜想太过幼稚可笑了吧。
回楼主的问题:
只需用MSDOS 7.1启动盘的两个程序:wait.com和shutdown.com。wait.com的用法很简单:wait 。
另外如果在规定时间范围内没有按任意键就返回errorlevel值0,否则返回按键的ASCII码。因此该批处理这样写就行了:
@echo off
echo The computer will reboot in 50 seconds,
echo Press any key to cancel...
wait 50
if not errlevel==0 shutdown r
Hehe, my guess of rebooting 50 times is too naive and ridiculous, right?
In response to the楼主's question:
Just use two programs from the MSDOS 7.1 boot disk: wait.com and shutdown.com. The usage of wait.com is very simple: wait .
In addition, if no key is pressed within the specified time range, an errorlevel value of 0 is returned; otherwise, the ASCII code of the pressed key is returned. Therefore, this batch script can be written like this:
@echo off
echo The computer will reboot in 50 seconds,
echo Press any key to cancel...
wait 50
if not errlevel==0 shutdown r