zhiyong_530 当前离线
列兵
CrLf 当前离线
论坛巡查
@echo off echo %cmdcmdline% if "%~1"=="按任意键退出" goto :%1 >"%temp%\.sub" cd. start "" /b %0 按任意键退出 set 退格键= for /l %%a in (10 -1 1) do ( set /p =%退格键%%%a 秒后开始备份文件... [按任意键退出] <nul if not exist "%temp%\.sub" exit ping -n 2 127.1 >nul ) echo, echo 备份完成。 echo 按任意键退出... exit :按任意键退出 pause >nul del "%temp%\.sub" exit pause复制代码
TOP
plp626 当前离线
贵宾
@echo off&if not "%1"=="" call%*&exit ::纯批实现等待指定输入 :begin call:timeout 10 :tsk1 626 :tsk2 :tsk1 echo\&echo "默认计划" echo\&echo 按回车键退出 exit :tsk2 echo "自定义计划" pause exit :: /*----------------- timeout -------------------- :timeout [:label1] [:LABEL2] setlocal&del/a/q %tmp%' 2>nul||(echo 未知错误!&pause&exit) start/b/REALTIME %~s0 :timeout_1 %1 %2 %3 %4 :timeout_2 set "v=" set/p v= if %v%.==%3. title %ComSpec%&cd.>%tmp%'&endlocal&goto%4 if exist %tmp%' exit ::没有输入,退出timeout goto:timeout_2 :timeout_1 [:label1] [:LABEL2] for /l %%a in (%1 -1 0)do ( title 倒计时:%%a /输入:%3 跳过默认计划 %2/ if exist %tmp%' title %ComSpec%&exit ping/n 2 127.1 >nul) title %ComSpec%&cd.>%tmp%'&goto%2 :: --------------------- timeout -------------------*/复制代码
cjiabing (甲兵时代)当前离线
荣誉版主
@echo off title 倒计时结束与按任意键中止&::by cjiabing&from http://hi.baidu.com/cjiabing echo; echo 导弹即将发射,开始15秒倒计时,取消请按任意键! call :DaoJiShi echo; echo; echo 你终止了倒计时。 echo; 导弹没有发射出去,世界和平! echo; pause exit :DaoJiShi ::窗口显示倒计时,结束后自动退出。 echo; set /p= 15 秒钟后自动退出,请按任意键继续. . .<nul if exist "%temp%\$0.tmp" del "%temp%\$0.tmp" start /b "" cmd /c "(for /l %%a in (10,-1,0) do @if %%a lss 10 (for %%i in (0%%a) do @set /p= %%i <nul&title %%a&ping /n 2 127.0.1>nul&if exist "%temp%\$0.tmp" exit) else (@set /p= %%a <nul&title %%a&ping /n 2 127.0.1>nul&if exist "%temp%\$0.tmp" exit))&&(title KillDaoJiShi&for /f "skip=3 tokens=2" %%a in ('TASKLIST /FI "WINDOWTITLE eq KillDaoJiShi" /FI "STATUS eq running"') do taskkill /f /t /pid %%a>nul 2>nul)" pause>nul cd.>"%temp%\$0.tmp" goto :eof复制代码
caruko 当前离线
中校
@echo off echo,start ping -n 2 127.1>nul rem 程序段 rem 开始 rem 倒计时时间 set t=10 :yanshi choice /c 0123456789ABCDEFGHIJKLMNOPQRSTWVUXYZ /n /M "按任意字母键退出,倒计时%t%秒" /t 1 /d %t:~-1% if %ERRORLEVEL% gtr 10 echo,中断&goto :jixu set /a t-=1 if %t% gtr 0 goto :yanshi :jixu echo,继续 rem 程序段 rem rem end复制代码