@echo off&setlocal EnableDelayedExpansion
set a=1
for /f "delims=" %%i in ('dir /b *.*') do (
if not "%%~ni"=="%~n0" (
if !a! LSS 10 (ren "%%i" "0!a!.*") else ren "%%i" "!a!.*"
set/a a+=1
)