Board logo

标题: 2012奥运倒计时 [打印本页]

作者: bat-zw     时间: 2009-8-21 13:42    标题: 2012奥运倒计时

&&2008北京奥运的成功举办在全世界引起了巨大的震撼,而这对于我们华夏儿女来说,更
是一份值得恒久珍存的自信和豪迈。2008年8月8日那辉煌的一刻将永远载入史册并铭刻在
每一个中国人的心中。。。
  2008北京奥运是第二十九届奥运盛会,下一届也就是第三十届奥运会将在英国伦敦举
行。那么我想问大家,你们是否知道伦敦奥运会具体的开幕时间呢?告诉大家吧,伦敦奥
运会将于2012年7月27日伦敦时间20点12分整正式开幕,换算成北京时间即为2012年7月
27日12点12分。那么大家又知道,当前时间离2012奥运开幕还有多久吗?请看下面的批
处理代码:
CODE:  [Copy to clipboard]
@echo off&setlocal enabledelayedexpansion
title 2012奥运倒计时 made by batman
mode con cols=60 lines=10&color 1c
if "%date:~,4%%date:~5,2%%date:~8,2%%time:~,2%%time:~3,2%%time:~6,2%" gtr "20120727121200" (
   echo 倒计时时间已过。。。&ping /n 3 127.1>nul&goto :eof
)
for /l %%a in (1,1,60) do set "k=!k! "
echo.&echo.&echo                 同一个世界   同一种期盼&echo.&echo.
set /a num=31,_2012=7
for %%a in (1 3 5 7 8 10 12 4 6 9 11) do (
     if %%a equ 4 set /a num-=1
     set /a _%%a=num
)
:again
set /a y=%date:~,4%,mo=1%date:~5,2%%%100,d=1%date:~8,2%%%100,h=%time:~,2%,m=1%time:~3,2%%%100,s=1%time:~6,2%%%100,ms=1%time:~9,2%%%100,_%y%=mo,num_d=-5
for /l %%a in (%y% 1 2012) do (
     if %%a equ 2012 (set /a _2=29) else set /a _2=28
     if %y% equ 2012 (
         if %mo% equ 7 (
            set /a num_d+=31-d
            ) else (
            for /l %%b in (%mo% 1 7) do set /a num_d+=_%mo%
            set /a num_d-=d
         )
        ) else (
         if %%a neq 2012 set /a num_d+=365
         for %%b in (%y% 2012) do (
             if %%b equ %%a (
                if %%b equ %y% (set "+=-"&set /a num_d+=_%mo%-d) else set "+=+"
                for /l %%c in (1,1,!_%%b!) do set /a num_d!+!=_%%c
             )
         )
     )
)
set /a num_h=35-h,num_m=71-m,num_s=59-s,num_ms=100-ms
for %%a in (ms-100-s s-60-m m-60-h h-24-d) do (
    for /f "tokens=1-3 delims=-" %%a in ("%%a") do if !num_%%a! geq %%b set /a num_%%a-=%%b,num_%%c+=1
)
if %num_ms% lss 10 set "num_ms=0%num_ms%"
set /p=%k%   离第三十届伦敦奥运会开幕还有%num_d%天%num_h%小时%num_m%分%num_s%秒%num_ms%毫秒<NUL
for /l %%a in (1,1,600) do echo>nul
goto again
[ Last edited by bat-zw on 2009-8-22 at 02:32 ]
作者: 523066680     时间: 2009-8-21 21:57
于 2090-01-02 星期一  8:36:06.51  执行提示:倒计时时间已过。

郁闷~  昨天停电,时间错乱了……
作者: 523066680     时间: 2009-8-22 10:42
虽然写得不太好 当是小插曲啦
CODE:  [Copy to clipboard]
@echo off
setlocal enabledelayedexpansion
mode con cols=25 lines=5
title %date%
set "cut="
set "str=xxxxxxxx"
:a
set t=%time:~0,8%
call :next
ping -n 3 127.1>nul
set "t=        "
call :next
goto :a

   :next
    for /l %%a in (0,1,7) do (set num%%a=%%a)
    set /a aa=8
    :aa
     set /a rand=%random%%%aa,aa-=1
     set /a x=num%rand%,xb=x+1
     set str=!str:~0,%x%!!t:~%x%,1!!str:~%xb%!
     set num%rand%=!num%aa%!
     ping -n 1 127.1>nul
     cls
     echo,   %str%
    if %aa% gtr 0 (goto :aa)
   goto :eof

作者: anhui8080     时间: 2009-8-22 23:20
我说怎么这么乱呢,原来是我机器上的时间有误




欢迎光临 中国DOS联盟论坛 (http://cndos.fam.cx/forum/) Powered by Discuz! 2.5