Lets say I have multiple files
filename.a.txt
filename.b.txt
filename.c.txt
I want to run a batch file that targets all .txt files and rename them to whatever I have set into my custom %filename% var + give them numbers so it would end up into something like:
filename.1.txt
filename.2.txt
filename.3.txt
So far I have wrote this:
set filename=FileTitle
for /r %%i in (*.txt) do call ren %%i %filename%.txt
And it works, but problem is that it just picks up first .txt file and gives it the FileTitle filename and that's it. I can't figure how to rename all .txt files in a batch and give them unique sequential number as a prefix/suffix/custom var to the outputed %filename%.txt
so something like e.g. %filename%-%uniquesuffix%.txt
. So I need to set some kind of variable that gives each file a unique number e.g. from 1-99 in alphabet order (default order that cmd prompt picked files up).
I did search other answers, but they show only how to add global/same prefix to renamed files.
SET /A
command. No reason to use theCALL
command. – Squashman