- @echo off & setlocal enabledelayedexpansion &rem by author Gan
- ::必须需要设置系统时间格式为:2020/02/02
- ::设置天数
- set /a nd=1
- ::设置路径
- set "f_path=D:\"
- ::Begin
- call :runnian %date:~0,4%
- call :test
- if !m! lss 10 set m=0!m!
- if !d! lss 10 set d=0!d!
- set "limit=!y!/!m!/!d!"
- echo 指定日期为:%limit%
- for /r "%f_path%" %%a in (*) do (set "file_t=%%~ta"
- set "file_t=!file_t:~0,10!
- if "%limit%" equ "!file_t!" echo %%~dpnxta
- )
- echo Done^^!
- pause&exit /b 0
-
- :test
- for /f "tokens=1-3 delims=/ " %%a in ("%date%") do (set /a y=%%a, m=1%%b%%100, d=1%%c%%100)
- if !nd! lss %d% (set /a d-=nd & goto :eof)
- set /a nd-=d, m-=1
- :loop
-
- for /l %%a in (1,1,2) do (
- if !m! LEQ 0 (set /a m=12, y-=1 & call :runnian !y!)
- set /a md = m!m!
- if !nd! lss !md! (set /a d=md-nd & goto :eof)
- set /a nd-=md, m-=1
- goto :loop)
-
- :runnian
- set /a m1=31, m2=28, m3=31, m4=30, m5=31, m6=30, m7=31, m8=31, m9=30, m10=31, m11=30, m12=31
- set /a n=0
- set /a a=%1%%4,a1=%1%%100,a2=%1%%400
- if !a! equ 0 set n=1& if !a1! equ 0 set n=0
- if !a2! equ 0 set n=1
- if !n! equ 1 (set /a m2=29) else (set /a m2=28)
- goto :eof
复制代码
|