Batch renaming - generic command line required

  The Potter 01:43 09 Jul 2010

Heck, don't know if I have the terms right but I'm sure someone might be able to write it for me in seconds when it would possibly take me days to work out so I'll risk asking!

Lets say I have 100 .mod files in a folder on my desktop (c drive) and the folder is called 'Downloaded Videos'. I want to rename the file extension of all 100 files from .mod to .mpeg.

Now I believe this can be done from a command line (MS Dos stuff) and I also belive a short bit of text can be written to get it to convert them all in one batch.

That is what I'm wondering - if someone wouldn't mind writing that for me so I can just copy and paste it?

I do hope I'm not asking the ridiculous and please forgive me if I actually do not know what I ask!

At the beginning of a weekend where I may just resolve the headache I've had ever since I brought a Canon camcorder three months ago, please know that it really would be the icing on the cake for me and one less of a dozen camcorder resolving tasks I hope to achieve this weekend!

Many Thanks


NB: And yes, I know, I could have probably found a more relevant site than this to pose the question ........

NB 2: running win xp

  100andthirty 06:02 09 Jul 2010

you can do this within Windows explorer, if you accept some limitations:

click here

  Eric10 10:33 09 Jul 2010

or using a batch file:

@echo off
CD "%USERPROFILE\Desktop\Downloaded Videos"
ren *.mod *.mpeg

The quotes are needed in the second line because your folder name has a space in it.
Placing "pause" at the end will keep the command window open so you can see error messages if any are generated and can be removed once you are happy it is working ok.

  Eric10 10:35 09 Jul 2010

Sorry, I missed off a % sign and the second line should read:

CD "%USERPROFILE%\Desktop\Downloaded Videos"

  The Potter 15:02 09 Jul 2010

Thanks 130 but it really was a batch file I wanted so, many thanks to Eric. :-)


  The Potter 10:10 16 Jul 2010

This has worked really great but I have just discovered I don't need to keep my video files on the C drive so I now want to download directly to my external E drive.

Please can someone advise me on the correct second line of code as I don't understand the CD bit? The path file wiil be E - Our Videos and the file will be called XYZ to start with as I will change it with each download. I'm guessing I won't need the USERPROFILE bit either.

Many thanks


  Eric10 12:48 16 Jul 2010

CD just means "Change Directory".
If you want the batch file to be on your desktop then you will need the batch file to change to the E: drive for you so you need to replace the second line with 2 lines.

CD "\Our Videos"

The first of these lines changes to the E: drive and the second line puts you into the Our Videos folder.

Don't be tempted to try and do it all on one line as:
CD "E:\Our Videos"
because this does not work.

  The Potter 13:29 16 Jul 2010

You're a superstar Eric, thank you. :-)

Just to make sure I have it exactly right, please can you confirm the following is correct:

@echo off
CD "Our Videos\XYZ"
ren *.mod *.mpeg

Where folder containing the .mod files is called XYZ?

  Eric10 16:28 16 Jul 2010

Yes that is correct. You'll just have to change the path if you put the next lot of videos into a different folder.

  The Potter 16:45 16 Jul 2010

Thank you!

This thread is now locked and can not be replied to.

Elsewhere on IDG sites

Best phone camera 2017

Stunning new film posters by Hattie Stewart, Joe Cruz & more

iPad Pro 10.5in (2017) review

28 astuces pour profiter au mieux de votre iPhone