
When you open a type of file (eg a .php file) for the first time Windows asks you to choose a program to open this file a.k.a “Open With” and from then on this type of file becomes associated with that program (unless you uncheck “Always use the selected program to open this kind of file”). While you can change this program association via Control Panel there is no option in the GUI for removing it. Windows XP had an option in the “Folder Options” (Tools Menu > Folder Option) dialog box to remove file associations but in Windows 7 you have to tweak the registry to delete a file type association. In this article we’ll see just that.
In addition to this I’ve also written on how to reset a .lnk file type association, this is when you/someone/some application accidentally (or intentionally) associates the .lnk extension with notepad (or some other program) this causes all shortcuts on your desktop and start menu to open notepad with absurd characters.
Go to Start menu > Run or press [windows] + R and enter regedit.
Before doing anything else take a backup of the registry by going to File menu > Export, enter a file name, choose a location and save. If you encounter problems in the future you can restore this file by going to File menu > Import and selecting the file.
Navigate to the following path
HKEY_CLASSES_ROOT\.<extension>
so for removing .html file type association go to
HKEY_CLASSES_ROOT\.html
Right-click and choose to delete the key and click yes to confirm it.
Next navigate to
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.<extension>
here we go to
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.html
Right-click and delete this key too.
Now when you try to open a file with a .html extension you’ll get the following window asking you to choose a program to open this file.
You might notice at this point that the thumbnails of .html files still show the icon of the previous program they were associated with, this will disappear once you logout of windows and login.
Resetting .lnk file type associations
One day when you login to your computer and open the start menu you see something similar below. Every shortcut on your desktop now looks like a text file and double clicking it opens notepad with some weird characters. This can very easily be solved by removing the .lnk association and associating lnk to “lnkfile” with a command.

The first letter in the extension “lnk” is a small “L” (l for link) and NOT a capital “i” (I for India) so be careful about this.
As mentioned previously open regedit and delete the following keys
HKEY_CLASSES_ROOT\.lnk HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.lnk
At this stage if you open any shortcut file you’ll be asked to choose a program to open the file. To fix this open a command-prompt with admin privileges by going to Start menu > All Programs > Accessories > right-click command prompt and choose “Run as administrator”
Enter the following command
assoc .lnk=lnkfile
All shortcut files will now be restored to their original icons and you’ll be able to open them normally.

I’d love to hear if it worked for you, do drop a comment below.
Hi, well explained. I too had this prob. So what i did is :
created a dummy .exe file. Then associated required extension file to this dummy exe program. then deleted the dummy .exe program file. worked for me.
It works for me, thank you very much for this post.
Oh My God, Worked!
Thanks for your post!
Resetting .lnk association worked for me. Thanks!
Thanks for this post! I reset successfully .lnk association!
It worked! I was just about to give up and write my pc off and then I found this info. Yours is the only fix (of the many other stated ones out there) that worked for me. Thank you so much for posting this info.
Thanks a lot ! — from the above dates it seems that this is a recent problem..
Regards,
ratul619
That’s a very old problem Ratul but I faced it only recently which is why I came up with this article 😉
I have windows 7 home premium. While reviewing .srt files in notepad, I inadvertently told the computer to open all .srt files in notepad. Before there was no program assigned to open .srt files. Now I can not undo that assignment. I also can not assign nothing, which is the way .srt files come. Subtitles now can no longer be added to my movies. Any ideas? I did the regedit recommendation without success. any help would be appreciated. Thanks. Lwslaw@sbcglobal.net
What do you do if it is not a file that was associated with the .lnk extension but a folder? (after having been infected with the$RECYCLER virus)?
Regards
Awesome; restored my .lnk files. Might mention too that instead of going to Accessories for your command prompt (which also is a .lnk and will be therefore confused on how to open) that you navigate to c:\windows\system32 and find CMD.EXE before right-clicking and choosing “run as admin”.
thnx. worked for me too. very helpful post..
Hi, there, Jesin. from mother russia with cold love)
Found your blog recently while googling for APC.PHP file.
so just want to remind about console win commands ASSOC , FTYPE
they should do what your topic name is )
and please beware that APC shouldn’t be called framework ) and forget the wp shait man, start doing smth serious man, go try some real php stuff – like yii, zend, symphony – those are real frameworks. Just kiddin )
buenas noches )
Made my day! THANK YOU.
I just want to say thanks. I was in the middle of a different mess and accidently made the notepad association to the .lnk files. This helped me get back to the previous problem quickly. Muchas gracias amigo mio.
I can’t open command prompt because it too is an .lnk file!
Hi Evan,
Press [Windows] + R to open the Run window and enter “system32”
Now search for cmd.exe, right-click and choose Run As Administrator.
i cant open regedit
because its also changed to .lnk
any idea about this please.?
If you are able to open the command line type “regedit” in it.
Hi. Thanks for this post. Works like a charm on Win7 PC. Kudos to you.
I’ve been trying to solve this puzzle for days…bless your heart, dude…you ARE the “go to” man.
I did have to use the “Press [Windows] + R to open the Run window and enter ‘system32’; now search for cmd.exe, right-click and choose Run As Administrator”. Thanks for adding that info, too.
Bottom line…IT WORKED, IT WORKED, IT WORKED!!!
That was great solution to very specific issue.
I have test it few times and it was perfect and simple.
Thank you for this article!
Wish you best
Thank you!!! THis worked great for me on Win 7 Pro 64 Bit
Thanks! It worked for me.
I had issues with .lnk files. This guide was far more useful than Microsoft’s one. Thanks 🙂
Ok. This looks great. But what if the extension is not .lnk but .exe?
Have managed to get into the registry to make changes to associations but need to do the last bit with CMD.exe……which I cant open. Any ideas? Please?
Try this – Press [Windows] + R and type system32, from the list of files find and right-click cmd.exe and choose Run As Administrator.
Excellent answer! Exactly what I was looking for!
I do a lot of onsite work with clients (agriculture software) and there is no internet. Any way I could get a .doc or .pdf of the above article?
Yes you can using a service called printfriendly. Use this URL http://www.printfriendly.com/print/?url=https://websistent.com/delete-file-association-windows-7/
Thanks a lot. It worked !!!!
Thank’s a lot it worked I unasociate .3dl files, that opened always in notepad
You are a HERO!!! it WORKED!!! ^^,
Worked perfectly when nothing else would. Thank you so much!!!
THANK YOU! Found other sites first on trying to get windows 7 .lnk association filetypes corrected and they were all coming up short. Yours worked and was very clear and easy to follow.
THANK YOU!
You explained very clearly and precise. works 100%.
Thank you! This worked exactly as documented. In my case, the .lnk were associated with adobe reader.
Excellent instructions.. worked perfectly!!
This helped immensely!! Thanks for this clear and detailed post!!
WORKED!!!!!!!!!! THANKS
I tried for many times watching many many many videos here in Brazil (I watched many Brazilian videos), read tutorials in portuguese too, but I just got nervous, but this simple post solve my life.
Thank you very much
👍👍👍 Worked great! Thanks!
Thanks a lot!! I´m from Brazil and it worked for me.
Good Vibes
Great job!
Thanks a lot!