Gelatojoe said:
I have lots of files that I want to add an extension to. Rather than add an
extension to each individual file, is there a was to add extensions to a
large number of files at the same time?
Here is how you can do it. The method assumes that none
of the files in the chose folder have an extension.
1. Click Start / Run / cmd {OK}
2.. Type these commands:
cd /d "%SystemRoot% {Enter}
notepad extension.bat {Enter}
3. Enter these lines:
@echo off
dir /b /a-d > c:\dir.txt
for /F %%a in (c:\dir.txt) do echo ren "%%a" "%%a.xxx"
(replace xxx with the desired extension)
4. Save the file but do not close it.
5. Type these commands:
cd /d "Q:\Some folder\Some Subfolder"{Enter}
(replace Q: with the drive letter for your folder
and use the correct folder and subfolder names)
extension.bat{Enter}
The last command shows you what ***would*** happen if
you activated the batch file you just wrote. To activate it, make
the last line like so:
for /F %%a in (c:\dir.txt) do ren "%%a" "%%a.xxx"
then run it again by typing extension.bat {Enter} at the Command
Prompt.
To rename files in other folders, simply run Steps 1 and 5.
Warning: Do not run this batch file more than once. If you run
it twice then you will get two extensions, and three if you run
it three times . . .