回复 17# czvde - @echo off
- REM 根据自己电脑实际情况设置ffmpeg的路径
- set "path=C:\Program Files\ffmpeg-n4.4-83-gb1f2d203c0-win64-gpl-4.4\bin;%path%"
- setlocal enabledelayedexpansion
- cd /d "%~dp0"
- for /f "tokens=1-2 delims=," %%i in ('type "a.txt"') do (
- for /f "delims=" %%a in ('dir /b /a-d *.mp4 *.jpg *.png ^| findstr /v /i /b /c:"视频" /c:"图片" ^| findstr /i /b "%%i"') do (
- if /i "%%~xa" equ ".mp4" (
- call :GetVideoInfo "%%a"
- ren "%%a" "视频%%j__123--(!str!)——%%a"
- ) else if /i "%%~xa" equ ".jpg" (
- call :GetJpgInfo "%%a"
- ren "%%a" "图片%%j__123--(!str!)——%%a"
- ) else if /i "%%~xa" equ ".png" (
- call :GetPngInfo "%%a"
- ren "%%a" "图片%%j__123--(!str!)——%%a"
- )
- )
- )
- goto :eof
-
- :GetVideoInfo
- for /f "tokens=10" %%x in ('ffmpeg -i "%~1" 2^>^&1 ^| find "Video:"') do (
- set "str=%%x"
- )
- goto :eof
-
- :GetJpgInfo
- for /f "tokens=8" %%x in ('ffmpeg -i "%~1" 2^>^&1 ^| find "Video:"') do (
- set "str=%%x"
- )
- goto :eof
-
- :GetPngInfo
- for /f "tokens=6" %%x in ('ffmpeg -i "%~1" 2^>^&1 ^| find "Video:"') do (
- set "str=%%x"
- )
- goto :eof
复制代码
|