本帖最后由 yakeyun 于 2022-1-23 16:38 编辑
- @echo off
- ::把批处理跟需处理的文件放在一起运行
- setlocal enabledelayedexpansion
- echo test >test.log
- for /f "delims=" %%a in ('dir /a-d /b ^|find /i /v "dest.log"') do (
- set "file=%%~dpa%%a"
- set "file=!file:\=\\!"
- for /f "tokens=1* delims=. " %%b in ('wmic datafile where name^="!file!" get CreationDate ^|find "."') do set "creationdate=%%b"
- set "tmpdate=!creationdate:~,4!/!creationdate:~4,2!/!creationdate:~6,2!"
- set "tmptime=!creationdate:~8,2!:!creationdate:~10,2!:!creationdate:~12,2!"
- copy /b "%%a"+,, /y
- )
- pause
复制代码
|