根据楼主提供的链接,以下代码处理13位时间戳。- @echo off
- cd /d "%~dp0"
- set "str=powershell -c "Get-Date ([timezone]::CurrentTimeZone.ToLocalTime(([datetime]::new(1970,1,1,0,0,0)).AddMilliseconds"
- for /f "delims=" %%i in ('dir /b /a-d *.jpg *.mp4') do (
- set n=%%~ni
- setlocal enabledelayedexpansion
- for /f "tokens=1-6" %%a in ('%str%(!n:~-13!))) -UFormat '%%Y %%m %%d %%H %%M %%S'"') do (
- endlocal
- ren "%%i" "%%a%%b%%c-%%d%%e%%f%%~xi"
- )
- )
- pause
复制代码
|