本帖最后由 xxpinqz 于 2014-1-20 12:18 编辑
你没仔细看吧,类似这样改- @echo off
- ::需要调用VBS
- rem 指定天数
- set DaysAgo=1
- >"%temp%\MyDate.vbs" echo LastDate=date()-%DaysAgo%
- >>"%temp%\MyDate.vbs" echo FmtDate=right(year(LastDate),4) ^& right("0" ^& month(LastDate),2) ^& right("0" ^& day(LastDate),2)
- >>"%temp%\MyDate.vbs" echo wscript.echo FmtDate
- for /f %%a in ('cscript /nologo "%temp%\MyDate.vbs"') do (
- set DstDate=%%a
- )
- set DstDate=%DstDate:~6,2%%DstDate:~4,2%%DstDate:~0,4%
-
- set curdate=%date:~8,2%%date:~5,2%%date:~0,4%
- 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:%dstdate%=%curdate%!
- echo,!foo!
- ))>"%%~fi._"
- move "%%~fi._" "%%~fi"
- )
- pause
- exit
复制代码 不认真,直接复制你的代码,echo时没改出错了 |