38

Disclaimer: I know how to set default apps and file extensions, I have done it many times previously.


I have just installed Windows 10 Home on a new machine. I'm trying to associate my web development files with Netbeans specifically, but that may be irrelevant.

1. File extensions not available

Firstly, lots of common file extensions I use are not present in the file extensions list - e.g. .php extension. I don't know if that is normally available in the Windows list. I certainly didn't have to manually add the .php extension on my previous computer with the same OS.

I solved this by adding the file extension manually. As I say, I have never had to do that before.


2. "Open With" doesn't save my choice of app

If I right-click on a file and "Open with" and enable "Always use this app to open files" it will open the file in the program I select, but the file icon in Explorer will not change, and it will not set it as the default program.

I still have to select "Open with" every time I open a file with that extension.


3. I cannot choose defaults by app

Settings > Default apps > Set defaults by app

My program (Netbeans) is not in the list of available apps.


4. I cannot choose defaults by file type

Settings > Default apps > Choose default applications by file type

If I select a file extension and "[+] Choose a default", when I select an app it will hang for a second as if it's working, then nothing happens. The default will not be set, and the "[+] Choose a default" button is still there.

Note: This does work for any file type with a default app already set.


Other Info

  • I can change the extension for common files such as PNG, TXT.
  • I cannot change extensions for files such as HTML, CSS, JS, PHP, SQL.
12
  • Based on your symptoms, there is some bug in your OS install and you should proceed to try to repair that. One other method to try though would be to modify your registry.superuser.com/questions/266268/… Oct 12, 2018 at 18:02
  • @music2myear I just did a "Start Fresh" reinstall of Windows 10 and I still have this problem after installing Netbeans. I cannot set default programs for CSS, JS, PHP, etc.
    – BadHorsie
    Oct 22, 2018 at 23:39
  • What about for TXT or .HTML or other files? Oct 22, 2018 at 23:47
  • @music2myear TXT yes, HTML no. I also checked my registry and it's fine.
    – BadHorsie
    Oct 23, 2018 at 9:43
  • 1
    Possible duplicate of Changing default Windows 10 file type association by standard dialog
    – Run5k
    Nov 14, 2018 at 13:35

5 Answers 5

13

Windows 10 patch KB4467682

Addresses an issue that prevents some users from setting Win32 program defaults for certain app and file type combinations using the Open with… command or Settings > Apps > Default apps.

I can confirm that this recent patch fixes the issue. Just update Windows 10 and it should work again

5
  • 1
    This has to be the most perfectly timed QA I have ever found on the Stack Exchange network! This was released yesterday and it has been bugging me for a while now but I just got around to digging into it.
    – Arvo Bowen
    Nov 28, 2018 at 21:27
  • I know! I didn't read when the question was asked, and then I read this answer, I expected it to be an update that happened months/years ago, so I would have already had it. Nope, just a few days ago! It's awful that this problem existed in the first place, though. I miss Windows 7. Dec 1, 2018 at 7:28
  • 3
    Well I'm late to the party, this issue is bugging me too - but in the meantime, kb4467682 has apparently been retracted. It seems to have caused bluescreens on Surface Book 2. Now what ? Is there a black market for these KB packs ? Jan 4, 2019 at 10:11
  • does your "recent" patch solves the problem of default apps by protocol? Still impossible as by November 2020
    – serge
    Nov 12, 2020 at 12:46
  • 1
    As @serge said this is not a solution. It simply does not work in 2023. Also, Windows remembers as default apps applications that have been long removed and the new ones have not been added.
    – Bogdan
    Sep 19, 2023 at 17:17
18

It is possible to add a new file association directly to the registry when the Windows interface does not work for new extensions:

  • Start regedit and click on HKEY_CLASSES_ROOT
  • Right-click on HKEY_CLASSES_ROOT and choose New and then Key.
  • Name the key according to the file extension, e.g. .ext. (If exists already, skip this step.)
  • Set the default value of the key you just created to some unused unique name, e.g. MyFileType. (If set already, skip this step.)
  • Repeat the above to create another new key with the above name, e.g. MyFileType. (If exists already, skip this step.)
  • Set the default value of this key to the name of the file type, e.g. File Type name.
  • Right-click MyFileType and create a new subkey named DefaultIcon.
  • Set the new key's default value to C:\path-to\executable,0 using the executable that is to handle the request. Pick another executable if yours does not contain icon resources. (0 is the index of the icon within the executable.)
  • Create another new key and call it shell.
  • For each verb/action you'd like to associate, create a new sub key with the desired name. Some verbs are preset and will automatically use localized names, e.g. open, edit or print.
  • For each verb create a sub key command and set its default value to the program to be run. Also make sure to include all parameters needed, adding quotes if there are spaces inside, e.g. "C:\My Path\My Program.exe" "%1". %1 will be replaced with the actual file name picked for this action.

For instance, here's a sample registry file to create an association between .txt files and EmEditor:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\.txt]
@="emeditor.txt"

[HKEY_CLASSES_ROOT\emeditor.txt]
@="Text Document"

[HKEY_CLASSES_ROOT\emeditor.txt\DefaultIcon]
@="%SystemRoot%\\SysWow64\\imageres.dll,-102"

[HKEY_CLASSES_ROOT\emeditor.txt\shell]

[HKEY_CLASSES_ROOT\emeditor.txt\shell\open]

[HKEY_CLASSES_ROOT\emeditor.txt\shell\open\command]
@="\"C:\\Program Files\\EmEditor\\EMEDITOR.EXE\" \"%1\""

[HKEY_CLASSES_ROOT\emeditor.txt\shell\print]

[HKEY_CLASSES_ROOT\emeditor.txt\shell\print\command]
@="\"C:\\Program Files\\EmEditor\\EMEDITOR.EXE\" /p \"%1\""
1
  • This, Thanks a lot. I had two versions of the same software installed (because different classes require different versions), and I couldn't change the way some file extensions opened by default. Your solution fixed it in less than 5 mins. Many thanks. :)
    – Jack_Hu
    Dec 19, 2019 at 23:23
1

I finally managed to solve this issue after finding an obscure forum post (I have now lost the link since reinstalling Windows).

The issue for me seems to have been related to installing Windows 10 with a Local account rather than linking a Microsoft account and logging in. I'm not sure if it's a bug.

The fix was to completely reinstall Windows 10 and link a Microsoft account (something I didn't want to do in the first place).

Note: Reinstalling via the "Start Fresh" option in the Windows Settings menu will not solve the issue, you must do a complete wipe and reinstall, then link a Microsoft account either during installation or immediately after before you try to change any settings.

5
  • 1
    I have used a local account since always and never had this sort of problem. The procedure I have outlined works for me and for a lot of other people. It's good that you have solved the problem, even though the solution of repeated fresh re-installation is somewhat too heavy. I think that the difference with the last install that worked is some action that you do during the installation or some product that you install.
    – harrymc
    Oct 24, 2018 at 6:36
  • @harrymc I get what you're saying, and I took a methodical approach to debugging the issue. I did each installation in the exact same manner, with the same options selected. I actually tried reinstalling twice with a local account and I had the same issue every time. I also installed only one program to attempt the file type change before installing anything else. I feel that editing the registry every time you want to change file associations is a worse solution, and does not truly solve the issue.
    – BadHorsie
    Oct 24, 2018 at 10:49
  • 1
    The new file association interface was supposed to make editing easier. But, as it many times happens with Microsoft, it instead made some things harder. We users must find workarounds whenever that happens.
    – harrymc
    Oct 24, 2018 at 11:24
  • 1
    I can confirm this. Happened to me too and I solved it with a reinstall and now a non-local account. I would also say that I didn't have this problem before Windows 10 version 1809 since my registry already shows assotiations to that specific program made earlier
    – nixda
    Nov 18, 2018 at 8:56
  • 1
    I use Microsoft account and have this issue too...
    – Mike
    Dec 10, 2018 at 20:44
1

I had the same problem in Windows 10. I solved with:

  1. in File Explorer, navigate to a file with the desired extension, i.e. *.html;
  2. right click with the mouse on the file -> Properties;
  3. in the General tab, section Open with:, press Change;
  4. select the desired default app for that extension and press OK;
  5. press Apply then OK.

And from now on, all the file with that extension will open with the selected app.

(The following image is in Italian but you should get the idea).

the Properties window

1
  • 1
    Finally an answer that was actually easy to follow and worked. Thank you! Dec 30, 2023 at 23:53
0

My solution was inspired by @harrymc's approach, but is perhaps more straight to the point.

  1. Start button -> type regedit.exe (Windows 10 won't seem to accept just plain regedit)
  2. Under HKEY_CLASSES_ROOT, lookup the file extension. For that registry item, look under OpenWithProgids\ where a valueless key will exist that indicates the filetype of this extension.
  3. Still under HKEY_CLASSES_ROOT, scroll down to that filetype, which also exists as a registry item. Under shell\open\command\, the key "(Default)" shows which executable will open the file. Modify the value to use the preferred executable, including any desired options, but leave the "%1" intact, to denote the file argument in question.
  4. Repeat this indirect search-and-replace under HKEY_LOCAL_MACHINE\SOFTWARE\Classes. I have no clue which setting prevails, perhaps some experimentation is in order.
  5. Restart Windows.
  6. An added benefit comes for free: under File Explorer, all files with this extension will now show the icon of the newly set preferred executable for opening those files.
2
  • 1
    Please don't just repeat another answer... Also, number 5. isn't necessary for the HKEY_CLASSES_ROOT directory of the registry. Furthermore the HKEY_LOCAL_MACHINE\SOFTWARE\Classes is just duplicated at Windows startup from the the CLASSES_ROOT directory (thus its name).
    – Jack_Hu
    Dec 19, 2019 at 23:26
  • Adding the empty OpenWithProgids finally got it working without the prompt for me. No idea why. Version 20H2. thanks.
    – MichaelE
    Apr 13, 2021 at 15:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .