Computing.Net > Forums > Windows XP > Batch script to rename files

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Click here to start participating now! Also, check out the New User Guide.

Batch script to rename files

Reply to Message Icon

Name: karthikrm
Date: February 9, 2009 at 11:37:18 Pacific
OS: Windows XP
Subcategory: General
Comment:

Hi,

i want to rename all the files in my directory by stripping out the first 3 chars of the file. My files are of the type

C:\01 file1.jpg
C:\02 file2.jpg

I want to change them to

C:\file1.jpg
C:\file2.jpg.

Any pointers on how to write a DOS batch script to do this?

thanks in adance.



Sponsored Link
Ads by Google

Response Number 1
Name: IVO
Date: February 9, 2009 at 12:33:19 Pacific
Reply:

:: MYREN.BAT  Usage: myren Folder_Name
@echo off & setlocal EnableDelayedExpansion
pushd %*
for /F "delims=" %%j in ('dir /B *.jpg') do (
  set file=%%j
  ren "%%j" "!file:~3!"
)
popd
:: End_Of_Batch


0

Response Number 2
Name: Curt R
Date: February 9, 2009 at 12:34:24 Pacific
Reply:

If you don't get a helpful reply quickly you can private message a computing.net member who goes under the name: Mechanix2Go

He's one of the best DOS based batchfilers I've ever met.


0

Response Number 3
Name: Valerie (by Garibaldi)
Date: February 9, 2009 at 12:35:42 Pacific
Reply:

This question has been asked countless times, just do a search for Rename Files


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


Trying to connect my XP l... problem with my pc



Post Locked

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


Go to Windows XP Forum Home


Sponsored links

Ads by Google


Results for: Batch script to rename files

Batch rename files www.computing.net/answers/windows-xp/batch-rename-files/162164.html

Need bat script to check file size www.computing.net/answers/windows-xp/need-bat-script-to-check-file-size/142283.html

Batch script to auto rename subtitles files www.computing.net/answers/windows-xp/batch-script-to-auto-rename-subtitles-files/176811.html