Question:
c:\folder\file.dat -> c:\folder\file_20101025123030.dat
Auswer
Windows2K:
set CUR_DATE=%DATE:~2,4%%DATE:~7,2%%DATE:~10,2%
Windows2003:
SET CUR_DATE=%DATE:~0,4%%DATE:~5,2%%DATE:~8,2%
IF "%TIME:~0,1%" == "" SET TIME_H=0%TIME:~1,1%
IF NOT "%TIME:~0,1%" == "" SET TIME_H=0%TIME:~0,2%
SET CUR_TIME=%TIME_H%%TIME:~3,2%%TIME:~6,2%
SET DAT_DIR=c:\folder
SET FILE_NM=file.dat
ren %DAT_DIR%\%FILE_NM% %FILE_NM:~0,-4%_%CUR_DATE%%CUR_TIME%%FILE_NM:~-4%
阅读(4333) | 评论(1) | 转发(0) |