set num=0
for %%i in (c:\hoge\*.jpg) do call :fuga %%i
exit /b
:fuga
set /a num+=1
ren %1 %num%.jpg
exit /b