How to add file extension to the files which do not have an extension in a specific folder using Windows command prompt?
I have folder (say c:\folder) in which many files reside. All of them are HTML documents. But some of them have not .html extension. I want to add them .html file extension using command prompt at once.
All the files which have not extension end with ^ character. All the file names have different lengths.
I have tried
ren *^ *^.htmlbut it did not rename all the files and prompted that
There is already an existing file with same name or file could not be found
3 Answers
^ is an escape character in cmd.exe. You have to escape it. Try ren *^^ *^^.html.
I try this and it works :
C:\test>ren *. *.htmlUpdate :with ^ in the name :
The following works (you may wish first to add echo before the ren to make sure that the command is doing what you want):
for %f in (*.) do ren "%f" "%f.html"You need the quotes in case the file name has embedded blanks.
2