无忧启动论坛

标题: 目前是否有方式可以实现在批命令执行过程中的等待干预,如无干预timeout默认? [打印本页]

作者: pppguest3962    时间: 2013-2-23 16:36
标题: 目前是否有方式可以实现在批命令执行过程中的等待干预,如无干预timeout默认?
比如说执行了gdisk给硬盘分区,
gdisk xxx /size:%%1    (具体参数不写了,大概能表达出我的想问的问题意思吧)

在执行之前wait 10秒,如果10秒内有press any key的干预,让你输入size的数值,
如果10秒内没有干预,%%1默认16000

目前是否有方式可以这么做?(打算在autoexec.bat里实现)
作者: yfwang0798    时间: 2013-2-23 19:47
纯dos,微软的dos中有choice命令。
作者: pppguest3962    时间: 2013-2-24 00:07
choice不能做到 15秒没选择就如何如何下一步。。。。
作者: yfwang0798    时间: 2013-2-24 07:26
以前写的一个测试程序
cls
@echo off
echo ******************************************************
echo * Select OS to install *
echo ******************************************************
echo.
echo To Build an ME Give Away ...press A
echo.
echo To Build an CMAR ...........press B
echo.
echo To Build an XP Give Away ...press C
echo.
echo To Build an Garage Sale
echo XP Home ..........press D
echo XP PRO ...........press E
echo.
echo To exit this program .......press X
echo.
echo.




choice /c:abcdex  /t:d,20 TYPE THE LETTER AND PRESS ENTER:
if errorlevel 6 goto exit
if errorlevel 5 GOTO xpp
if errorlevel 4 GOTO xph
if errorlevel 3 GOTO xpga
if errorlevel 2 GOTO cmar
if errorlevel 1 GOTO mega
goto end

:mega
echo run mega
goto end

:cmar
echo run cmar
goto end

:xpga
echo run xpga
goto end

:xph
echo run xph
goto end

:xpp
echo run xpp
goto end

:exit
echo run exit
goto end

:end
作者: feifanll    时间: 2013-2-24 09:57

ping 127.0.1 -n 5
pause
不知是否可以满足楼主需求?
作者: sikro    时间: 2013-2-24 20:51
提示: 作者被禁止或删除 内容自动屏蔽
作者: pppguest3962    时间: 2013-2-24 22:45
谢谢楼上各位鼎力解答;
只是可惜在纯DOS启动的autobat.bat里有这个需求
在用gdisk分区的时候,想在15秒内提示有无干预,如果有干预,就输入一个主盘分区的大小,如果15秒内没动静,那就自动设置为16GB;
不好意思了,我其实应该开章就明盘了这个问题,
感谢感谢!!!!
作者: yfwang0798    时间: 2013-2-25 06:55
choice命令是dos6.22的外部命令,不是内部命令,另外这个应用例子除了choice外(代码在logon.bat) ,另一个老外作的菜单似乎更符合要求.
http://dl.vmall.com/c08c7olth1




欢迎光临 无忧启动论坛 (http://bbs.c3.wuyou.net/) Powered by Discuz! X3.3