此代码用的SET/P,如果倒计时不是退出而是执行后面的代码,会出问题!
asdfghasdfgh 发表于 2011-1-25 17:09
请问楼主,如果倒计时不是退出而是执行后面的代码,会出什么问题!- @echo off
- if not "%1"=="" goto %1
- del "%temp%\#" 2>nul
- start /b %~fs0 :aa
- :agn
- set/p=按任意键退出...<nul&pause>nul
- >"%temp%\#" type nul
- exit
- :aa
- for /l %%a in (10 -1 1) do (
- title 倒计时 %%a 秒后自动退出...
- if exist "%temp%\#" (
- del "%temp%\#"
- exit
- )
- ping -n 2 127.1>nul
- )
- title Windows2000
- color 1f
- mode con lines=10
- set work=0
- set n=0
- set mo=0
- set number=0
- set all=60
- set time=%all%
- :show
-
- :check
- if %number% GTR %mo% set num=%num%▉&set /a mo=%mo%+1&goto check
-
- :2
-
- cls
- echo 进度: %n% / %all% 剩余时间:%time%秒
- echo.
- echo.
- echo 完成 %work% %%%
- echo.
- if not "%num%"=="" echo %num%
- if not "%num%"=="" echo %num%
-
- if %work%==100 goto end
-
- ping 127.1 -n 1 >nul
- set /a n=%n%+1
- set /a time=%all%-%n%
- set /a work=(%n%)*100/(%all%)
- set /a number=%work%/3
- set /a number=%number%+1
- goto show
- endlocal
-
- :end
- title 正在退出...
-
- taskkill /im cmd.exe /fi "windowtitle eq 正在退出..."
复制代码
|