[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖
@echo off
set num=10 9 8 7 6 5 4 3 2 1
for %%i in (%num%) do (
        echo %%i
        ping 127.0.0.1 >nul
)
pause

TOP

@echo off
set "times=10"
echo 按任意字母键退出运行程序,默认 10 秒启动程序
:bgn
set/p=还剩下 %times% 秒...<nul
if "%times%"=="0" goto :run

set /a "times-=1"
choice /T 1 /C 0e /d 0 >nul
if "%errorlevel%"=="1" (goto :bgn) else (goto :end)


:run
echo.
echo 程序已经启动...
pause>nul
goto :eof


:end
echo.
echo 已经退出程序...

pause>nul

TOP

  1. set a=10
  2. :times
  3. echo %a%
  4. set t=%time:~0,8%
  5. :loop
  6. if %t% == %time:~0,8% goto loop
  7. if %a% lss 0 goto out
  8. set /a a-=1
  9. goto times
  10. :out
  11. pause>nul
复制代码

TOP

  1. @echo off
  2. for /l %%i in (10,-1,1) do (echo %%i & ping 127.1 -n 2 2>&1 >null)
复制代码

TOP

我是不是第一个写timeout延迟的人
  1. @echo off
  2. :a
  3. echo 10&timeout /nobreak 1>nul
  4. echo 9&timeout /nobreak 1>nul
  5. echo 8&timeout /nobreak 1>nul
  6. echo 7&timeout /nobreak 1>nul
  7. echo 6&timeout /nobreak 1>nul
  8. echo 5&timeout /nobreak 1>nul
  9. echo 4&timeout /nobreak 1>nul
  10. echo 3&timeout /nobreak 1>nul
  11. echo 2&timeout /nobreak 1>nul
  12. echo 1&timeout /nobreak 1>nul
  13. echo 0&timeout /nobreak 1>nul
  14. goto a
复制代码

TOP

@echo off
for /l in (0 1 10) do (
echo %%i
ping 127.1 -t -n 2
)

TOP

  1. @echo off
  2. for /l %%i in (10 -1 1) do (
  3. ping 127.1 /n 2 >nul&echo,%%i
  4. )
  5. pause
复制代码
交作业

TOP

本帖最后由 impk 于 2019-7-29 12:46 编辑
  1. @echo off
  2. set var=10
  3. :1
  4. echo %var%
  5. set /a var=%var%-1
  6. ping /n 2 127.1>nul
  7. if %var% lss 0 goto :eof
  8. goto :1
复制代码

TOP

方法1:
  1. @echo off
  2. set a=10
  3. :a
  4. if %a%==0 pause
  5. echo %a%
  6. ping /n 2 127.0.1>nul
  7. set /a a-=1
  8. goto :a
复制代码
方法2:
  1. @echo off
  2. for /l %%i in (10,-1,0) do echo %%i&ping /n 2 127.0.1>nul
复制代码
方法三:
@echo off

TOP

方法1:
  1. @echo off
  2. set a=10
  3. :a
  4. if %a%==0 pause
  5. echo %a%
  6. ping /n 2 127.0.1>nul
  7. set /a a-=1
  8. goto :a
复制代码
方法2:
  1. @echo off
  2. for /l %%i in (10,-1,0) do echo %%i&ping /n 2 127.0.1>nul
复制代码
方法三:
  1. @echo off
  2. set a=10
  3. :a
  4. if %a%==0 pause
  5. echo %a%
  6. timeout /t 1 /NOBREAK>nul 2>nul
  7. set /a a-=1
  8. goto :a
复制代码
等等......

TOP

@echo off
set a=0
:kaishi
cls
set /a a=a+1
if "%a%"=="11" goto end
echo %a%
ping /n 2 127.1>nul
goto kaishi
:end
echo 完成
pause
exit

TOP

  1. @echo off
  2. echo wscript.sleep 1000 >sleep.vbs
  3. for /l %%i in (10,-1,0) do (
  4. echo %%i
  5. sleep.vbs
  6. )
  7. del sleep.vbs
复制代码

TOP

  1. @echo off
  2. for /l %%i in (10,-1,0) do (
  3. echo %%i
  4. timeout /T 1 /NOBREAK
  5. )
复制代码

TOP

本帖最后由 cmd1152 于 2021-7-28 15:36 编辑

  1. for /l %%i in (10,-1,0) do (
  2. echo %%i
  3. ping -n 2 127.1>nul
  4. )
  5. pause
复制代码
梦依旧在,只是,心有余而力渐有不足
年年岁岁花相似,岁岁年年人不同

TOP

比以前有进步,知道踏踏实实练内功了。

TOP

返回列表