---------------------------------------------------- @echo off set B= for /F %%A in ('dir /B *.jpg') do call :part2 %%A goto end :part2 set B=%1 ren %B% %B:~-7% :end ----------------------------------------------------