本帖最后由 77七 于 2024-5-9 15:08 编辑
回复 6# gddsssko
exit /b和call搭配使用及时退出循环。- @echo off
- rem 批处理保存为utf-8编码格式
- chcp 65001 >nul
- cd /d "%~dp0"
- for /f "delims=" %%d in ('dir /b /ad') do (
- for /f "tokens=3" %%a in ('dir /s /-c "%%d" ^|findstr /rec:" bytes"') do (
- set s=%%a
- )
- call :1 "%%d"
- )
- pause & exit
-
- :1
- for %%i in ("%~1\*.mp4") do (
- for /f "delims=" %%a in ('mediainfo --Output^="Video;分辨率:%%Width%%x%%Height%% 帧率:%%FrameRate%%" "%%i"') do (
- for /f "delims=." %%b in ('powershell -c "%s%/1024/1024"') do (
- ren "%~1" "%~1 %%a 大小:%%b M"
- exit /b
- )
- )
- )
- exit /b
复制代码
|