这个虽然准确但是漏了一些不符合条件没有报告- chcp 65001 >nul
- set /a m=n=2
- set /a "Jan=1,Feb=2,Mar=3,Apr=4,May=5,Jun=6,Jul=7,Aug=8,Sep=9,Oct=10,Nov=11,Dec=12"
- for /f "delims=" %%x in ('dir /b /a-d *.txt') do (
- setlocal enabledelayedexpansion
- for /f "useback tokens=1-9* delims=,. " %%a in ("%%x") do (
- if %%h equ 1 (
- set t1=%%d-!%%b!-%%c %%e
- set t2=%%f
- set ss1=%%j
- set s2=
- ) else if %%h equ 2 (
- if defined ss1 (
- set s2=1
- )
- ) else if %%h equ 3 (
- if defined s2 (
- call :1 "!t1!" "%%d-!%%b!-%%c %%e"
- if "%%f" geq "!t2!" (
- set /a m=n-1
- )
- if !DiffSecs! leq !m! (
- if "!ss1!" neq "%%j" (
- if not defined _"%%x" (
- >>out.txt echo %%x
- set _"%%x"=1
- )
- )
- )
- set ss1=
- set s2=
- )
- ) else (
- set ss1=
- set s2=
- )
- )
- endlocal
- )
- pause
- exit
-
- :1
- set StartTime=%~1
- set EndTime=%~2
- set StartTime=%StartTime:-= %
- set StartTime=%StartTime::= %
- set EndTime=%EndTime:-= %
- set EndTime=%EndTime::= %
- call :DateToSecs %StartTime% StartSecs
- call :DateToSecs %EndTime% EndSecs
- set /a DiffSecs=EndSecs-StartSecs
- set DiffSecs=%DiffSecs:-=%
- goto :eof
-
- :DateToSecs %yy% %mm% %dd% %hh% %nn% %ss% secs
- setlocal ENABLEEXTENSIONS
- set yy=%1&set mm=%2&set dd=%3&set hh=%4&set nn=%5&set ss=%6
- if 1%yy% LSS 200 if 1%yy% LSS 170 (set yy=20%yy%) else (set yy=19%yy%)
- set /a dd=100%dd%%%100,mm=100%mm%%%100
- set /a z=14-mm,z/=12,y=yy+4800-z,m=mm+12*z-3,j=153*m+2
- set /a j=j/5+dd+y*365+y/4-y/100+y/400-2472633
- if 1%hh% LSS 20 set hh=0%hh%
- if {%nn:~2,1%} EQU {p} if "%hh%" NEQ "12" set hh=1%hh%&set/a hh-=88
- if {%nn:~2,1%} EQU {a} if "%hh%" EQU "12" set hh=00
- if {%nn:~2,1%} GEQ {a} set nn=%nn:~0,2%
- set /a hh=100%hh%%%100,nn=100%nn%%%100,ss=100%ss%%%100
- set /a j=j*86400+hh*3600+nn*60+ss
- endlocal&set %7=%j%&goto :EOF
复制代码 上面代码只报告了4.txt 不符合条件
但是漏了以下这些不符合条件没有报告, 还需要添加几个条件- 5.txt
- 6.txt
- 7.txt
- 8.txt
- 9.txt
复制代码
|