@echo off setlocal enabledelayedexpansion for %%f in (*.jpeg) do ( set "filename=%%~nf" ren "%%f" "!filename!.jpg" ) endlocal