CODE: [Copy to clipboard]@echo off set num=0 setlocal enabledelayedexpansion for %%a in ("C:\test\*.txt") do ( set /a num+=1 ren "%%a" !num!.txt )