- @echo off
- set /p str=input:
- call :1
- if defined k (
- echo 合法
- ) else (
- echo 非法
- )
- pause
- exit
-
- :1
- setlocal
- for /f %%a in ('wmic os get localdatetime ^|findstr [0-9]') do set year=%%a&call set year=%%year:~0,4%%
- set /a _1=_3=_5=_7=_8=_10=_12=31,_4=_6=_9=_11=30
- rem "http://www.bathome.net/redirect.php?goto=findpost&ptid=3769&pid=24349"
- set/a num=!(year%%4) ^& !(!(year%%100)) ^| !(year%%400),1/num 2>nul && set _2=29|| set _2=28
- setlocal enabledelayedexpansion
- for /l %%l in (1,1,12) do for /l %%m in (1,1,!_%%l!) do (set l=0%%l&set m=0%%m&set #!l:~-2!/!m:~-2!=1)
- if defined #!str! (endlocal &endlocal &set k=1) else (endlocal &endlocal)
- exit /b
复制代码
|