回复 15# qd2024
以0开头的数字- @echo off
- SETLOCAL ENABLEDELAYEDEXPANSION
- chcp 936
-
- set ffPath=D:\Program Files
-
- set folderPath=%~dp1
- set folderName=%~nx1
-
-
- pushd "%folderPath%\%folderName%"
-
- echo "--1--"
- set time=0
- for /f "usebackq tokens=* delims=" %%a in (` dir /b *.mp4 `) do (
- for /f "usebackq" %%i in (`" "%ffpath%\ffprobe.exe" -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 "%%a" "`) do (
- set time=!time! + %%i
- )
- )
- for /f "usebackq" %%a in (` powershell -command " [math]::Ceiling( (%time%) / 60 ) " `) do (
- set time=%%a
- )
- echo %time%
-
- echo "--2--"
- set/a time=0
- for /f "usebackq tokens=* delims=" %%a in (` dir /b *.mp4 `) do (
- for /f "usebackq tokens=1,2 delims=." %%i in (`" "%ffpath%\ffprobe.exe" -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 "%%a" "`) do (
- set/a time+=%%i
- )
- )
- set/a time/=60
- set/a q=%time%%60
- if %q% gtr 0 (set/a time+=1)
- echo %time%
-
- echo "--3--"
- set/a time=0
- for /f "usebackq tokens=* delims=" %%a in (` dir /b *.mp4 `) do (
- for /f "usebackq tokens=2,3,4 delims=:. " %%i in (` ""%ffpath%\ffprobe.exe" "%%a" 2>&1 | findstr Duration" `) do (
- set/a time+=1%%i*3600+1%%j*60+1%%k-100*3600-100*60-100
- )
- )
- set/a time/=60
- set/a q=%time%%60
- if %q% gtr 0 (set/a time+=1)
- echo %time%
-
- popd
-
- pushd "%folderPath%"
- echo ren "%folderName%" "%folderName%[%time%]"
- popd
-
- pause
- exit/b
复制代码
|