Windows 10 won't let me set default apps for file extensions
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.
Solution 1:
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
Solution 2:
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 chooseNew
and thenKey
. - 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 namedDefaultIcon
. - 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
orprint
. - 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\""
Solution 3:
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.