回复 3# xmzhihui - @echo off
- setlocal enabledelayedexpansion
- cd /d "D:\txt所在目录\"
- set n=1
- for %%a in (*.txt) do (
- >dstdate.vbs echo LastDate=date(^)+!n!
- >>dstdate.vbs echo,FmtDate=right(year(LastDate^),4^) ^& right("0" ^& month(LastDate^),2^) ^& right("0" ^& day(LastDate^),2^)
- >>dstdate.vbs echo wscript.echo FmtDate
- for /f %%b in ('cscript /nologo dstdate.vbs') do set "tdate=%%b"
- del dstdate.vbs
- set "ndate=!tdate:~4,2!月!tdate:~6,2!日"
- ren "%%a" "!ndate!%%~xa"
- set /a n+=1
- )
- pause
复制代码
|