『第
2 楼』:
@echo off & setlocal ENABLEEXTENSIONS
for /f "tokens=1 delims=:" %%i in ('findstr /i /n "^\[%computername%\]$" EsState.txt') do set n=%%i
for /f "skip=%n% tokens=2 delims== " %%i in (EsState.txt) do set day=%%i&&goto :next
:next
for /f "tokens=2,3 delims=-" %%i in ("%day%") do set mon=0%%i&&set dat=0%%j
set day=%day:~0,5%%mon:~-2%-%dat:~-2%
::::Will Sort ::::
call :Date2Day %date:~0,10% sdays
set /a sdays-=5
call :Day2Date %sdays% difdate
if "%day%" LSS "%difdate%" copy.exe
goto :EOF
:Date2Day
setlocal ENABLEEXTENSIONS
for /f "tokens=1-3 delims=/-, " %%a in ('echo/%1') do (
set yy=%%a & set mm=%%b & set dd=%%c
)
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
endlocal&set %2=%j%&goto :EOF
:Day2Date
setlocal ENABLEEXTENSIONS
set /a i=%1,a=i+2472632,b=4*a+3,b/=146097,c=-b*146097,c/=4,c+=a
set /a d=4*c+3,d/=1461,e=-1461*d,e/=4,e+=c,m=5*e+2,m/=153,dd=153*m+2,dd/=5
set /a dd=-dd+e+1,mm=-m/10,mm*=12,mm+=m+3,yy=b*100+d-4800+m/10
(if %mm% LSS 10 set mm=0%mm%)&(if %dd% LSS 10 set dd=0%dd%)
endlocal&set %2=%yy%-%mm%-%dd%&goto :EOF [ Last edited by yovie on 2007-8-14 at 04:14 PM ]
|