回复 3# cjiabing - @echo off||倒计时;
- :: 备份自用 code by plp
-
- if "%1"==":timeout" (goto%1)else start/b %~fs0 :timeout "2015-1-1"
- cmd /k "prompt=-$g$s&echo 获取帮助请键入 help "
- exit
-
- :timeout
- set dates=%date%
- call:edate "%dates:~0,10%" "%~2" xx
- set/a xx-=1
- :lp
- call:time2i "%time%" i&call:i2time 8640000-i hfs
- title 现在距离 %~2 还有 %xx%天 零 %hfs% 秒
- goto:lp
-
- rem ------------------------- sub ----------------------------
- :time2i <time> <rt>
- setlocal&set t=%~1
- set/a w=1%t:~-2%,s=1%t:~-5,2%,f=1%t:~-8,2%,h=1%t:~-11,2%
- set/a w-=100,s-=100,f-=100,h-=100,i=h*3600+f*60+s,i=i*100+w
- endlocal&(if %2.==. (echo %i%)else set %2=%i%)&goto:eof
- :i2time <i> <hour> <minute> <second> <perseconde>
- setlocal&set/a t=%1
- set/a w=t%%100,t/=100,h=t/3600,t%%=3600,f=t/60,t%%=60,s=t
- for %%a in (%w%.w,%s%.s,%f%.f,%h%.h)do set %%~xa=0%%~na
- set ret=%.h:~-2%:%.f:~-2%:%.s:~-2%.%.w:~-2%
- endlocal&(if %2.==. (%ret%)else set %2=%ret%)&goto:eof
-
- :edate <"DATE1"> <"DATE2"> <RetVarName>
- setlocal
- set d1=%~1&set d2=%~2
- set d1=%d1:~0,10%&set d2=%d2:~0,10%
- set d1=%d1:-= %&set d2=%d2:-= %
- call:date2i %d1: 0= % i1
- call:date2i %d2: 0= % i2
- set/a c=i2-i1
- endlocal&(if %3.==. (echo %c%) else set %3=%c%)&goto:eof
-
- :date2i <year> <month> <day> <RetVarName>
- setlocal&set/a y=%1,m=%2,d=%3
- set/am+=9,m%%=12,y-=m/10,i=365*y+y/4-y/100+y/400+(m*153+2)/5+d-1
- endlocal&(if %4.==. (echo %i%)else set %4=%i%)&goto:eof
复制代码
|