[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖
只想到了ping来延时。。
  1. @echo off
  2. echo 现在开始倒计时
  3. for /l %%i in (10,-1,0) do (
  4. ping -n 2 127.0.0.1>nul
  5. echo %%i)
  6. echo 时间到
  7. pause>nul
复制代码

TOP

  1. @echo off
  2. set /p a="请输入爆炸倒计时秒数:"
  3. cls & echo 距离爆炸只有%a%,请跑到1万米外
  4. ping -n 2 127.1 >nul &
  5. set /a a=a-1
  6. cls
  7. for /l %%i in (%a%,-1,0) do (
  8. echo 距离爆炸还有%%i秒
  9. ping -n 2 127.0.0.1 >nul & cls
  10. )
  11. echo 如果你没有跑开1万米,你已经:GAME OVER
  12. pause
复制代码

TOP

@echo off
for /l %%i in (10,-1,0) do (echo %%i)
pause>nul

TOP

  1. @echo off
  2. for /l %%a in (10,-1,0) do (echo;%%a
  3. for /l %%b in (0,1,3000) do echo.>nul)
  4. pause
复制代码

TOP

  1. @echo off
  2. echo 开始倒计时10秒
  3. for /l %%i in (10,-1,0) do (
  4. set /a num=5000
  5. call :loop
  6. echo %%i
  7. )
  8. rem 通过该调用使数字不会一下子出现,可通过改变num值改变快慢
  9. :loop
  10. if not "%num%"=="0" (
  11. set /a num=%num%-1
  12. goto loop )
复制代码

TOP

  1. @echo off
  2. set a=0
  3. :start
  4. echo %a%
  5. set /a a+=1
  6. if %a% gtr 10 echo 4秒后自动退出&ping -n 4 127.1>nul&exit
  7. goto start
  8. pause
复制代码

TOP

  1. @echo off
  2. for /l %%a in (5,-1,1) do echo %%a
  3. pause
复制代码
  1. @echo off
  2. for  %%a in (10,9,8,7,6,5,4,3,2,1) do echo %%a
  3. pause
复制代码

TOP

For /l %%i in(10,-1,0) do echo %%i
pause

TOP

  1. @echo off
  2. :1
  3. setlocal enabledelayedexpansion
  4. for /l %%i in (10,-1,0) do (
  5. set sum+=1
  6. ping 127.1 /n 2 >nul&echo %%i
  7. if !sum! gtr 0 goto :1)
  8. pause
复制代码

TOP

  1. @echo off
  2. echo lose time to end
  3. mode con cols=40 lines=20&color 5f
  4. for /l %%i in (10,-1,0) do ( echo %%i
  5. for  /l %%a in (1,1,2000) do echo %%a>nul  )
  6. pause
复制代码

TOP

@echo off
:a
set /a n+=1
if not %n% equ 11 set/p=%n% <nul&timeout /t 1 /nobreak >nul&goto :a
pause
踏实一些点.不要着急.你想要的时间都会给你.2

TOP

本帖最后由 shelluserwlb 于 2014-11-7 07:46 编辑

:: 批处理循环十秒倒计时
  1. @echo off
  2. set /a m=10
  3. :1
  4. echo %m%
  5. set /a m-=1 & ping -n 2 127.1>nul
  6. if %m% lss 0 goto :end
  7. goto :1
  8. :end
  9. echo 倒计时结束!& pause>nul
复制代码

TOP

纯批处理延时
示例:
1. 延时 10 秒:
  1. call :Slepp1d  10
复制代码
2. 延时23小时:
  1. call :Slepp1d  82800
复制代码
注意:不支持超过一天的延时(应小于86400秒)

代码如下
  1. @echo off
  2. setlocal enabledelayedexpansion
  3. call :Slepp1d 10
  4. pause
  5. goto :eof
  6. :: Call :Slepp1d_loop 5
  7. goto :eof
  8. :Slepp1d
  9.   if not defined time_start (
  10.     set/a n_sleep=%~1
  11.     set time_start=%time%
  12.     call :Slepp1d_Count !time_start!
  13.     if not defined n_star set/a n_star=!dt1c!
  14.   )
  15.   call :Slepp1d_count %time%
  16.   set/a n_now=%dt1c%
  17.   set/a n_check=%n_star% + %n_sleep% - %n_now%
  18.   if %n_check% geq 0 (
  19.     if "%n_check%" neq "%n_check_last%" echo %n_check% %hns%
  20.     set n_check_last=%n_check%
  21.     ping -w 500 -n 2 0.0.0.0 >nul
  22.     goto :Slepp1d
  23.   )
  24.   goto :eof
  25. :Slepp1d_Count
  26.   set dt1=%~1
  27.   for /f "delims=: tokens=1,2,3*" %%i in ("%dt1%") do (
  28.     set dt1h=%%i
  29.     if "!dt1h:~0,1!"=="0" set/a dt1h=!dt1h:~1,1!
  30.     set dt1n=%%j
  31.     if "!dt1n:~0,1!"=="0" set/a dt1n=!dt1n:~1,1!
  32.     set dt1s=%%k
  33.     set dt1s=!dt1s:~0,2!
  34.     if "!dt1s:~0,1!"=="0" set/a dt1s=!dt1s:~1,1!
  35.   )
  36.   set "hns=%dt1h%:%dt1n%:%dt1s%"
  37.   set/a dt1c=(%dt1h% * 60 * 60) + (%dt1n% * 60) + (%dt1s%)
  38.   set/a dt1c=%dt1c% %% (60 * 60 * 24)
  39.   goto :eof
复制代码
『千江有水千江月』千江有水,月映千江;万里无云,万里青天。    http://yu2n.qiniudn.com/

TOP

@echo off

for /l %%a in (10,-1,1) do (

        echo %%a

        ping 127.0.0.1 -n 9>nul

        cls
)

pause>n

TOP

本帖最后由 ads350668398 于 2014-10-23 18:40 编辑

:a
echo 10
ceho 9
echo 8
ceho 7
echo6
5
4
3
2
1
0
ping/n 20 127.0.0.1>nul
goto a

TOP

返回列表