本帖最后由 terse 于 2014-1-18 22:25 编辑
回复 1# simon4055 - @echo off
- set /a y=%date:~,4%,d=1%date:~8,2%-100,"m=(1%date:~5,2%-91)%%12+4,y-=m/14"
- set /a "JD=1461*Y/4+153*M/5+d-5071,y=(JD*4-489)/1461,d=jd-1461*y/4,m=d*100/3061,d-=153*m/5-100,y+=m/14,m-=m/14*12-99"
- set "qdate=%y%%m:~-2%%d:~-2%"
- setlocal enabledelayedexpansion
- for /f "delims=" %%i in ('dir /s/b *.txt') do (
- (for /f "delims=" %%a in ('type "%%~fi"') do (
- set "foo=%%a"
- set foo=!foo:15012014=%qdate%!
- echo;!foo!
- ))>"%%~fi._"
- move "%%~fi._" "%%~fi"
- )
- pause
- exit
复制代码 原来是前一天日期换成当天 前面没看清 重写- @echo off
- set adate=%date:~,4%%date:~5,2%%date:~8,2%
- set /a y=%date:~,4%,d=1%date:~8,2%-100,"m=(1%date:~5,2%-91)%%12+4,y-=m/14"
- set /a "JD=1461*Y/4+153*M/5+d-5071,y=(JD*4-489)/1461,d=jd-1461*y/4,m=d*100/3061,d-=153*m/5-100,y+=m/14,m-=m/14*12-99"
- set "qdate=%y%%m:~-2%%d:~-2%"
- setlocal enabledelayedexpansion
- for /f "delims=" %%i in ('dir /s/b *.txt') do (
- (for /f "delims=" %%a in ('type "%%~fi"') do (
- set "foo=%%a"
- set foo=!foo:%qdate%=%adate%!
- echo;!foo!
- ))>"%%~fi._"
- move "%%~fi._" "%%~fi"
- )
- pause
- exit
复制代码
|