可以试试看,先看下你的系统时间设置。对于复制命令可以自行添加参数。- @echo off
- setlocal enabledelayedexpansion
- echo %date%
- for /f "tokens=* delims=" %%a in ('dir/b/s/a-d *.docx') do (
- set ftime=%%~ta
- echo %%a !ftime!
- :2018/09/10 周一 14:28
- set "year=!ftime:~0,4!"
- set "month=!ftime:~5,2!"
- set "day=!ftime:~8,2!"
- set "hour=!ftime:~14,2!"
- set "minute=!ftime:~17,2!"
- copy "%%a" "c:\bak\!year!!month!!day!!hour!!minute!.docx"
-
- )
- pause
复制代码
|