Batch file renaming

April 7, 2009 at 11:22:39
Specs: Windows XP

I could use a batch file to rename multiple files of type:



Thanks in advance

See More: Batch file renaming

Report •

April 7, 2009 at 16:00:58
Below is just one method of renaming, change the paths to suit your needs:

:: Code begins...
@echo off

for /f "tokens=1-3 delims=." %%1 in ('dir /a-d /b %temp%\*.bmp') do (
     set reject=%%1
     set name=%%2
     set ext=%%3 & call :renameit
dir %temp%\*.bmp
exit /b

ren %temp%\%reject%.%name%.%ext% %name%.%ext%
goto :eof
:: Code ends....

Hope this helps, also hope it's not homework!.

Report •

April 8, 2009 at 06:47:45
Thank you Valerie,

Nice use of tokens & delimeters! I'm embarassed to say its not homework. :)

Report •

Related Solutions

Ask Question