Jesin's Blog

Welcome to the Portal of Technology

  • Facebook
  • GitHub
  • Google+
  • RSS
  • Twitter
  • Home
  • Categories
    • Domains
    • Linux
    • Networking
    • PHP
    • Virtualization
    • Web Design
    • Web Servers
    • Windows
  • WordPress Plugins
    • Custom Error Pages
    • HTTP Digest Authentication
    • Mailgun Email Validator
  • Toolbox
    • DNS Lookup Tool
    • htdigest Generator Tool Online
    • htpasswd Generator Tool Online
    • HTTP Headers Lookup Tool
    • MD5 Encryption Tool
    • Open Port Check Tool
    • SHA-1 Encryption Tool
    • URL Encoding/Decoding Tool
  • About Me
  • Contact Me
  • Sitemap
Home ›
Windows ›
How to delete a file association in Windows 7

How to delete a file association in Windows 7

July 24, 2013 Windows Jesin A 43 Comments

windows category thumbnail

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.

open 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.

delete HKCR file extension

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.

delete HKCU file extension

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.

windows choose program to open 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.

.lnk extension associated notepad
This is how my start menu looked before applying this solution

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

delete HKCR lnk extension

delete HKCU lnk extension

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”

cmd run as administrator

Enter the following command

assoc .lnk=lnkfile

cmd assoc lnkfile

All shortcut files will now be restored to their original icons and you’ll be able to open them normally.

.lnk extension association reset
This is how my start menu looks now after I reset the .lnk file association.

I’d love to hear if it worked for you, do drop a comment below.

Related posts:

windows category thumbnailInternet Explorer Change User Agent windows category thumbnailChange Registered To in Windows windows category thumbnailDisable Right Clicking on the Desktop windows category thumbnailHide Last Logged in Username in Windows (Registry Tweak) windows category thumbnailDisable Low Disk Space Warning in Windows

Tags: windows registry

Comments

  1. vj says

    August 21, 2013 at 10:57 pm

    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.

    Reply
  2. Mfon says

    October 27, 2013 at 2:54 pm

    It works for me, thank you very much for this post.

    Reply
  3. Rooster says

    November 10, 2013 at 10:32 am

    Oh My God, Worked!

    Thanks for your post!

    Reply
  4. Tim says

    November 25, 2013 at 12:18 pm

    Resetting .lnk association worked for me. Thanks!

    Reply
  5. Emilio says

    November 29, 2013 at 7:50 pm

    Thanks for this post! I reset successfully .lnk association!

    Reply
  6. grateful says

    December 2, 2013 at 11:03 am

    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.

    Reply
  7. Ratul619 says

    December 2, 2013 at 8:43 pm

    Thanks a lot ! — from the above dates it seems that this is a recent problem..

    Regards,
    ratul619

    Reply
    • Jesin A says

      December 2, 2013 at 11:53 pm

      That’s a very old problem Ratul but I faced it only recently which is why I came up with this article 😉

      Reply
      • lester says

        April 22, 2014 at 5:28 am

        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

        Reply
      • Benjamin Muller says

        November 10, 2014 at 6:09 pm

        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

        Reply
  8. Jim says

    December 17, 2013 at 2:22 am

    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”.

    Reply
  9. al says

    December 20, 2013 at 7:09 pm

    thnx. worked for me too. very helpful post..

    Reply
  10. Yuri says

    January 19, 2014 at 9:05 pm

    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 )

    Reply
  11. Caroline says

    February 19, 2014 at 3:15 pm

    Made my day! THANK YOU.

    Reply
  12. Kim says

    May 14, 2014 at 7:14 pm

    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.

    Reply
  13. Evan says

    May 18, 2014 at 11:29 pm

    I can’t open command prompt because it too is an .lnk file!

    Reply
    • Jesin A says

      May 18, 2014 at 11:33 pm

      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.

      Reply
  14. Masih Farhan says

    August 6, 2014 at 10:59 am

    i cant open regedit
    because its also changed to .lnk
    any idea about this please.?

    Reply
    • Jesin A says

      August 6, 2014 at 12:32 pm

      If you are able to open the command line type “regedit” in it.

      Reply
  15. Glen says

    August 20, 2014 at 9:39 am

    Hi. Thanks for this post. Works like a charm on Win7 PC. Kudos to you.

    Reply
  16. bjfewell says

    September 5, 2014 at 3:33 am

    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!!!

    Reply
  17. Pesho NT says

    September 11, 2014 at 7:57 pm

    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

    Reply
  18. Jake says

    October 4, 2014 at 12:04 pm

    Thank you!!! THis worked great for me on Win 7 Pro 64 Bit

    Reply
  19. Bhupi says

    November 16, 2014 at 11:01 pm

    Thanks! It worked for me.

    Reply
  20. Rob says

    November 20, 2014 at 12:59 pm

    I had issues with .lnk files. This guide was far more useful than Microsoft’s one. Thanks 🙂

    Reply
  21. NF says

    November 21, 2014 at 7:29 pm

    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?

    Reply
    • Jesin A says

      November 22, 2014 at 10:54 pm

      Try this – Press [Windows] + R and type system32, from the list of files find and right-click cmd.exe and choose Run As Administrator.

      Reply
  22. fish14 says

    November 25, 2014 at 5:47 am

    Excellent answer! Exactly what I was looking for!

    Reply
    • fish14 says

      November 25, 2014 at 5:48 am

      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?

      Reply
      • Jesin A says

        November 25, 2014 at 2:43 pm

        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/

        Reply
  23. Bala says

    December 12, 2014 at 1:54 pm

    Thanks a lot. It worked !!!!

    Reply
  24. goce says

    February 9, 2015 at 8:56 am

    Thank’s a lot it worked I unasociate .3dl files, that opened always in notepad

    Reply
  25. L0caL says

    February 9, 2015 at 8:54 pm

    You are a HERO!!! it WORKED!!! ^^,

    Reply
  26. Joannie says

    April 3, 2015 at 7:36 pm

    Worked perfectly when nothing else would. Thank you so much!!!

    Reply
  27. Dan says

    April 14, 2015 at 8:06 pm

    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.

    Reply
  28. Imran Hanif says

    November 26, 2015 at 7:57 pm

    THANK YOU!
    You explained very clearly and precise. works 100%.

    Reply
  29. Karen says

    March 28, 2016 at 6:22 am

    Thank you! This worked exactly as documented. In my case, the .lnk were associated with adobe reader.

    Reply
  30. Naja says

    April 15, 2016 at 1:20 am

    Excellent instructions.. worked perfectly!!

    Reply
  31. Gopinath says

    June 28, 2016 at 8:37 pm

    This helped immensely!! Thanks for this clear and detailed post!!

    Reply
  32. Leticia says

    November 5, 2017 at 9:42 am

    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

    Reply
  33. John Smith says

    April 15, 2019 at 10:52 pm

    👍👍👍 Worked great! Thanks!

    Reply
  34. Renato says

    April 28, 2019 at 3:05 pm

    Thanks a lot!! I´m from Brazil and it worked for me.
    Good Vibes

    Reply
  35. José Henrique says

    May 4, 2019 at 2:00 am

    Great job!
    Thanks a lot!

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Get a wealth of information delivered to your inbox. Subscribe and never miss a single article.

  • Tutorials and howtos
  • Code, scripts and commands
  • Online Tools

* No spam, unsubscribe anytime

Hire Me

  • SSL installation and hardening (A+ on Qualys SSL test)
  • Apache & Nginx configuration
  • Email deliverability improvement (10/10 on Mail Tester & MailGenius)
  • WordPress customization, optimization and migration
  • and much more…

    Tools

    • DNS Lookup Tool
    • htdigest Generator Tool Online
    • htpasswd Generator Tool Online
    • HTTP Headers Lookup Tool
    • MD5 Encryption Tool
    • Open Port Check Tool
    • SHA-1 Encryption Tool
    • URL Encoding/Decoding Tool

    Nav

    • Home
    • About Me
    • Contact Me
    • Privacy Policy
    • Sitemap
    Vultr SSD VPS

    Creative Commons License
    Jesin's Blog by Jesin A is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
    Based on a work at websistent.com.