- @echo off&setlocal enabledelayedexpansion
- for /f "tokens=1,2 delims=:" %%i in ('time/t') do set hh=%%i&set mm=%%j
- for /f "tokens=1-3 delims=- " %%i in ('date/t') do set year=%%i&set month=%%j&set day=%%k
- set/a month=100%month%%%100,day=100%day%%%100,hh=100%hh%%%100,hh-=1
- if %hh% equ -1 set/a hh=23&call :datejs
- set/a month=10%month%,day=10%day%,hh=10%hh%
- set month=%month:~-2%&set day=%day:~-2%&set hh=%hh:~-2%
- set "rqsj=%year%-%month%-%day% %hh%:%mm%"
- for /f "delims=" %%i in ('dir/b/s/a-d e:\') do if "%%~ti" geq "%rqsj%" echo %%i
- pause&exit
- :datejs //**日期计算部分,以前写的,拿来凑合用**//
- for %%i in (1,5,7,10,12) do (
- if %month% equ %%i (
- if %day% neq 1 (set/a day-=1&goto :eof
- ) else (
- if %month% neq 1 (set/a month-=1,day=30&goto :eof
- ) else (set/a year-=1,month=12,day=31&goto :eof)
- )
- )
- )
- for %%i in (2,4,6,8,9,11) do (
- if %month% equ %%i (
- if %day% neq 1 (set/a day-=1&goto :eof
- ) else (set/a month-=1,day=31&goto :eof)
- )
- )
- set/a mod=!(year%%4)^&!(!(year%%100))^|!(year%%400)
- if %month% equ 3 (
- if %mod% equ 1 (
- if %day% neq 1 (set/a day-=1&goto :eof
- ) else (set/a month-=1,day=29&goto :eof)
- ) else (
- if %day% neq 1 (set/a day-=1&goto :eof
- ) else (set/a month-=1,day=28&goto :eof)
- )
- )
复制代码
|