Computing.Net > Forums > Windows Vista > Creating a batch script to rename image files

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Creating a batch script to rename image files

Reply to Message Icon

Name: rigel2112
Date: July 18, 2009 at 00:45:34 Pacific
OS: Windows Vista
Subcategory: General
Comment:

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?



Sponsored Link
Ads by Google

Response Number 1
Name: batchnoob
Date: July 24, 2009 at 15:30:59 Pacific
Reply:

I can't help but this may be a useful resource:
http://ss64.com/nt/

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


0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Windows Vista Forum Home


Sponsored links

Ads by Google


Results for: Creating a batch script to rename image files

Creating a batch file in Vista? www.computing.net/answers/windows-vista/creating-a-batch-file-in-vista/273.html

Creating a batch file www.computing.net/answers/windows-vista/creating-a-batch-file/4640.html

Create a batch fiile www.computing.net/answers/windows-vista/create-a-batch-fiile/5763.html