setlocal EnableDelayedExpansionset filename=fileset counter=0for /f "usebackq delims=*" %%i in (`dir /b *.jpg`) do ( set /a counter+=1 ren "%%i" "%filename%!counter!.jpg")