@echo off setlocal enabledelayedexpansion set var=102 echo %var% set /a i = i + var for %%x in (*) do ( if not "%%x"=="rename.bat" ( set /a i+=1 rename "%%x" "!i!.jpg" ) ) pause