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