本帖最后由 ppll2030 于 2024-1-28 22:17 编辑
二楼的时间好像有问题,我段位低,理解不了。
所以用Batcher大大的分段截取代码,再组合一下。
楼主可以试试。- @echo off
- setlocal enabledelayedexpansion
- set folder=%~1
- set ffpath=H:\共享影视\Download\FFmpeg\ffmpeg.exe
- pushd "%folder%"
- for /f "delims=" %%i in ('dir /b /s /a-d *.avi *.mkv *.mp4 *.rmvb *.wmv') do (
- for /f "tokens=2 delims=, " %%a in ('%ffpath% -i "%%i" 2^>^&1 ^| find "Duration:"') do set "str=%%a"
- set str=!str:~0,-3!
- for /f "tokens=1-3 delims=:" %%x in ("!str!") do (
- set "hh=%%x"
- set "mm=%%y"
- set "ss=%%z"
- set /a minutes=1!hh!*60-6000
- set /a minutes+=1!mm!-100
- if !ss! neq 0 (set /a minutes+=1)
- )
- set /a Totalduration+=!minutes!
- )
- popd
- echo ren "%~1" "%~n1【!Totalduration!】"
- pause
复制代码
|