17

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.
  • 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/… – music2myear Oct 12 '18 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 '18 at 23:39
  • What about for TXT or .HTML or other files? – music2myear Oct 22 '18 at 23:47
  • @music2myear TXT yes, HTML no. I also checked my registry and it's fine. – BadHorsie Oct 23 '18 at 9:43
  • 1
    Possible duplicate of Changing default Windows 10 file type association by standard dialog – Run5k Nov 14 '18 at 13:35
8

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

  • 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 '18 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. – Will Ediger Dec 1 '18 at 7:28
  • 2
    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 ? – user1564286 Jan 4 at 10:11
5

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

I finally managed to solve this issue after finding an obscure forum post (I have now lost the link since reinstalling Windows). The user reportedly spent many hours reinstalling Windows 10 multiple times to figure out the problem.

The issue is 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 or some sort of restriction by Microsoft.

Apparently, once you start working with a Local account and begin trying to change your default app settings, the whole thing gets messed up and you will never be able to fix it. The fix is 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.

  • 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 '18 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 '18 at 10:49
  • 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 '18 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 '18 at 8:56
  • I use Microsoft account and have this issue too... – Mike Dec 10 '18 at 20:44
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.

protected by Community Nov 27 '18 at 22:37

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.