setlocal enabledelaydexpansion
delayedexpansion 说明见:https://blog.csdn.net/rhcgrys/article/details/124283862
- 批量for循环转码文件(或修改文件后缀)
for /f “delims=” %%a in (‘dir /b^|findstr /l “.avi .mp4 .mkv”‘) do (
if not exist “%%~na.mpeg” (
ffmpeg -i “%%~a” -c:v mpeg2_qsv -qscale 8 -c:a mp3 -vf subtitles=”filename=%%~na.srt:charenc=GBK” “%%~na.mpeg”
)
)
注:修改for命令,可同时处理多种视频文件转码mpeg
2. 获取所有系统服务详细信息,比如提取系统服务执行文件路径
@for /f “tokens=1,2 delims= ” %i in (‘sc query state^=all ^|findstr SERVICE_NAME’) do ( @sc qc %j | findstr BINARY_PATH_NAME >> svr.lst)