linfeng_321 当前离线
三级士官
TOP
zaqmlp 当前离线
上尉
@echo off&cd /d "%~dp0" set "exefile1=.\nconvert.exe" set "exefile2=.\pngquant.exe" if not exist "%exefile1%" (echo;"%exefile1%" 未找到&pause&exit) if not exist "%exefile2%" (echo;"%exefile2%" 未找到&pause&exit) for %%a in ( "D:\xxx\文件夹1" "E:\yyy\文件夹2" "E:\zzz\文件夹3" ) do ( if exist "%%~a" ( for /f "delims=" %%b in ('dir /a-d-h/b/s "%%~a\*.jpg" "%%~a\*.png" 2^>nul') do ( echo;"%%~b" if /i "%%~xb" equ ".jpg" ( "%exefile1%" -quiet -overwrite -q 70 "%%~b" ) if /i "%%~xb" equ ".png" ( "%exefile2%" --force --ext .png --quality 70-80 "%%~b" ) ) ) ) pause exit复制代码