@echo off
:Main
cls
set day=%date%
set days=0
echo.&echo.
::echo 当前日期是:%day%
echo.
::set /p input= 请指定要追溯的天数:
setlocal enabledelayedexpansion
:: 提取日期
for /f "tokens=1-3 delims=-/. " %%i in ("%day%") do (
set /a sy=%%i, sm=100%%j %% 100, sd=100%%k %% 100
)
::set /a sd-=input
:: 这里的5是指取前5天
set /a sd-=5
if %sd% leq 0 call :count
cls&echo.&echo.
echo 当前日期是:%day%
echo.
set sm=0%sm%
set sd=0%sd%
set ldate=%sy%-%sm:~-2%-%sd:~-2%
if not exist d:\IPXCC_RECORD\luyinwenjian\%ldate% mkdir d:\IPXCC_RECORD\luyinwenjian\%ldate%
move d:\IPXCC_RECORD\RecoderEveryday\%ldate%*.* d:\IPXCC_RECORD\luyinwenjian\%ldate%\
::pause >null
goto :eof
:count
set /a sm-=1
if !sm! equ 0 set /a sm=12, sy-=1
call :days
set /a sd+=days
if %sd% leq 0 goto count
goto :eof
:days
:: 获取指定月份的总天数
set /a leap="^!(sy %% 4) & ^!(^!(sy %% 100)) | ^!(sy %% 400)"
set /a max=28+leap
for /f "tokens=%sm%" %%i in ("31 %max% 31 30 31 30 31 31 30 31 30 31") do set days=%%i
goto :eof
阅读(809) | 评论(0) | 转发(0) |