Page 1 of 1

Re: rename extention of a file

Posted: 15 Jan 2021 17:05
by penpen
You might do something like that (sketched and untested):

Code: Select all

@echo off
setlocal enableExtensions disableDelayedExpansion

set "N=1000000000"
for %%a in ("*12345-*" "*-*12345") do (
	for /f "tokens=* delims=" %b in ('set /a "N"') do (
		echo(ren "%%~a" "%%~b.txt"
	set /a "N+=1"

goto :eof
Sidenote: I echoed the commands it should do, so you can check if that's what you like to perform.
In case you are satisfied with the commands created, you might want to delete the "echo(".