Creating a batch script to rename image files

July 18, 2009 at 00:45:34
Specs: Windows Vista
I am trying to create a script to rename image files to simply a number sequence(####.jpg). I want it to ask what number to start from then rename all the files in the directory from that number on. So far I have this:

@Echo Off
setLocal EnableDelayedExpansion
set /p incr=Enter the starting number:
for %%f IN (*.jpg) do (
set incr=!incr!
ren "%%f" "!incr!.jpg"
set /A incr+=1

And it sorta works. The problem is it sometimes starts at the number specified and sometimes it starts at the next number. I need this to be precise since the numbers have to correspond with database entries. What is wrong? Or is there a better way to do this?

See More: Creating a batch script to rename image files

Report •

July 24, 2009 at 15:30:59
I can't help but this may be a useful resource:

"An open mind leaves a chance for someone to drop a worthwhile thought into it."

Report •
Related Solutions

Ask Question