Board logo

标题: 批处理几秒等待无动作时自动执行默认的命令行 [打印本页]

作者: huangshuirun     时间: 2009-6-19 08:44    标题: 批处理几秒等待无动作时自动执行默认的命令行
求教批处理启动后选项行在几秒等待无动作时自动执行默认的命令行,当批处理执行后,进入到可选择画面,当无选择时批处理自己按默认的选项运行。

作者: tireless     时间: 2009-6-19 10:28
作者: radem     时间: 2009-6-21 07:26
@echo off
if not "%1"=="" call %*
del "%temp%\#" 2>nul
start /b %~fs0 :aa
echo.&echo 1.打开c盘 2.打开d盘
echo.&set/p var=请输入:
if exist "%temp%\#" (del "%temp%\#"&exit)
>"%temp%\#" type nul&ping -n 2 127.1>nul
goto :%var%
:1
start c:\&exit
:2
start d:\&exit
:aa
for /l %%a in (10 -1 0) do (
title 倒计时 %%a 秒,无选择将打开 c 盘...
if exist "%temp%\#" (
del "%temp%\#"
title 用户已作选择...
exit
)
ping -n 2 127.1>nul
)
>"%temp%\#" type nul&start c:\&title 回车退出...&exit

作者: huangshuirun     时间: 2009-6-27 07:53
问题已解决