DelphiFAQ Home Search:

Change file type association for a certain extension

 

commentsThis article has not been rated yet. After reading, feel free to leave comments and rate it.

Question:

I need to edit HTML files on my hard disk for a while now and want to open each of them with Notepad instead of FrontPage. So what I want to change is how Windows opens HTML documents when I double click on them. I don't want to have to right click on each of those documents, select 'Open With...' and then choose notepad. Is there a quick way to change the association?

Answer:

You could rename all your files from *.html to *.txt - difficult if you have tons of subdirectories. Or maybe something else keeps you from it (e.g. you may want to test the HTML files and they are linked across each other).

The solution is a Windows command line tool called assoc.

The box below shows what you can do in your case.

# at the command line prompt, enter these commands

C:\Temp>assoc .html
.html=htmlfile

C:\Temp>assoc .txt
.txt=txtfile

# now change the association
C:\Temp>assoc .html=txtfile
.html=txtfile

# now do your work

# undo the change
C:\Temp>assoc .html=htmlfile
.html=htmlfile

# save all your associations to a config file:
C:\Temp>assoc >assoc_config.txt

Comments:

 

 

Email address (not necessary):

Rate as
Hide my email when showing my comment.
Please notify me once a day about new comments on this topic.
Please provide a valid email address if you select this option.
 
It seems that you are
from Washington, US .

Info/ Feedback on this

Show city and country
Show country only
Hide my location
Leave your comment here:
Please type in the code:
photo Add a picture:

Please do not post inappropriate pictures. Inappropriate pictures include pictures of minors and nudity. The owner of this web site reserves the right to delete such material.