MS DOS Batch File Change file name

I have a bunch of image files that have no extension. I'd like to run a batch file that adds .jpg to all files in a folder.

Please help.
webdorkAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

webdorkAuthor Commented:
what
0
JohnBusiness Consultant (Owner)Commented:
Try rename *. *.jpg

Test first but that should do what you want.

.... Thinkpads_User
0
aboo_sCommented:
you don't need a batch file for that:

ren *. *.jpg

this will change all no extensions to .jpg extension!
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

webdorkAuthor Commented:
dont you need to declare the folder?
0
Dave BaldwinFixer of ProblemsCommented:
It would be safer if you went to the folder so it wouldn't affect any other folders.
0
Steve KnightIT ConsultancyCommented:
you already have your answer, but to clarify:

open a cmd.exe prompt
cd /d c.\whatever
check the directory is showing
do the ren command above.

before you do if you do:

dir *.  

it will show you the files in that dir without an extension - could be they do have an extension but one that explorer hides etc.

steve
0
JohnBusiness Consultant (Owner)Commented:
don't you need to declare the folder?

It is easier to navigate to the folder and run from within the folder

Run rename /?  to see how it works. You cannot create a new path for the destination. But you can declare the path at the source.

... Thinkpads_User
0
webdorkAuthor Commented:
I keep getting syntax error.
0
JohnBusiness Consultant (Owner)Commented:
You did not mention above any syntax error except for the last post.

Open a command prompt, navigate to the folder in question, type:

rename *.  *.jpg and press enter.

Please record the error here. Thanks.

... Thinkpads_User
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
webdorkAuthor Commented:
rename *.*.jpg is not recognized as an internal or external command
0
JohnBusiness Consultant (Owner)Commented:
I just created a test example, followed the steps I outlined above, and the rename worked without a problem.

... Thinkpads_User
0
webdorkAuthor Commented:
Dos screen capture
0
webdorkAuthor Commented:
ren *.* *.jpg

This worked
0
JohnBusiness Consultant (Owner)Commented:
Open Command and type    rename /?

Is this Windows 7 Pro or Windows 7 Home?

Open Windows Explorer, Tools, Folder Options and do two things in the View tab:

Select Show Hidden Files   and
Uncheck Hide Extensions

Do those two things, let us know about Home / Pro and please post back.

... Thinkpads_User
0
JohnBusiness Consultant (Owner)Commented:
So then either:

1. It was Explorer settings,   or, more llikely,

2. The files had extensions after all. You said no extensions.

... Thinkpads_User
0
webdorkAuthor Commented:
rename /?
renames a file or folder

Win 7 Pro

I think i figured it out. All files were named similar to this:
Hansen_Birds_of_The_Sierra_10x16.7_Plate_001

I'm guessing the routine was thinking there was en extension since there is a period.
0
Steve KnightIT ConsultancyCommented:
there was no space in screenshot between rename and *

Steve
0
webdorkAuthor Commented:
Thank you the quick response
0
JohnBusiness Consultant (Owner)Commented:
In one rename there was no space; in the other there was a space.

@webdork  - A period always makes for an extension in DOS so in DOS terms there was an extension. That is why ren (rename) *.  did not work but ren (rename) *.* did work.

The command and syntax along with the help instruction at the beginning was all correct. You need to use DOS rules in a command shell.

... Thinkpads_User
0
JohnBusiness Consultant (Owner)Commented:
@webdork  - Thanks and I was happy to help.

... Thinkpads_User
0
webdorkAuthor Commented:
your welcome. I've got a more complex issues I'll post separately. Can I notify you when the post is up?
0
JohnBusiness Consultant (Owner)Commented:
Yes. Post here with a link to the new question and I will endeavour to help.
.... Thinkpads_User
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming

From novice to tech pro — start learning today.