15楼的结果:73050行,还没有看到错误的日期。
c:\Test>timeit test.bat
Elapsed Time: 0:00:34.590
Process Time: 0:00:23.212 | @echo off&setlocal enabledelayedexpansion | | set start=1810-01-01 | | set end=2010-01-01 | | set /a sy=%start:~,4%,sm=1%start:~5,2%%%100,sd=1%start:~8,2%%%100,ey=%end:~,4%,em=1%end:~5,2%%%100,ed=1%end:~8,2%%%100,a=31 | | for %%a in (1 3 5 7 8 10 12 4 6 9 11) do ( | | if %%a equ 4 set /a a-=1 | | set /a _%%a=a | | ) | | (for /l %%a in (%sy%,1,%ey%) do ( | | set /a "_2=^!(%%a%%4)&^!(^!(%%a%%100))|^!(%%a%%400)+28" | | set /a a=1,b=12 | | if "%%a" equ "%sy%" set /a a=sm | | if "%%a" equ "%ey%" set /a b=em | | for /l %%b in (!a!,1,!b!) do ( | | set /a c=1,d=_%%b | | if "%%a%%b" equ "%sy%%sm%" set /a c=sd | | if "%%a%%b" equ "%ey%%em%" set /a d=ed | | for /l %%c in (!c!,1,!d!) do ( | | for %%d in (%%b %%c) do set ".%%d=0%%d"&set ".%%d=!.%%d:~-2!" | | echo %%a-!.%%b!-!.%%c! | | ) | | ) | | ))>15.txtCOPY |
|