Fixing Issues With FileType New Command (And Context Menu 'New' File Options)

I thought this info might come in handy for someone, and also I wanted to write it down so I can remember in the future. While figuring this out I also figured out how to create some custom native 'New' context menu entries, but I'll probably make a separate writeup for that later.


Problem:
If you're ever having trouble with the Filetype NEW command not working, it might have to do with the file association. In the below example it's for .zip but could apply to anything.

For example, I couldn't get it to create a new .Zip archive, nothing would happen. Eventually I realized in the registry, the "Name" of the filetype for .zip was set as WINRAR.ZIP, not the default CompressedFolder. (This was despite the Windows Settings app saying that .Zip files were associated with Windows Explorer)

Possible Problem Cause:
As described in the docs for the Filetype command, it uses whatever built in context menu handler Windows has for creating that new file type. But with the association changed, in this case with it changing the "name" of the filetype from the default CompressedFolder, it doesn't see the 'new' handler that is associated with that CompressedFolder type. The 'name' of the file type is usually defined by looking at the HKEY_CLASSES_ROOT registry path, then the file extension including the period, then the (Default) value for it.

Possible Solution 1 (Maybe Not Ideal):

Change the (Default) value back to CompressedFolder (or whatever the original name was). However, depending on your situation, you might not actually want to get rid of the non-default file association with a third party program.

Solution 2 (Allows keeping your custom file association):

Basically: Copy the ShellNew registry key contents from the original file type name, to just below the file extension entry in HKEY_CLASSES_ROOT (in this case to HKEY_CLASSES_ROOT\.zip\ShellNew).

So even if there is some other association or changed file type name defined for the extension, if the ShellNew information exists just below the extension data, it will still by used by Directory Opus (or probably windows in general).

Note that the ShellNew info might be located different places, read below for more info.

More Details / Explanation:
I noticed that the ShellNew for CompressedFolder was located right within the .zip key already, but depending on the file type, it may also be located under the file name's key entry in HKCR. For example, there is indeed a key at HKEY_CLASSES_ROOT\CompressedFolder, but I guess it doesn't have the ShellNew there, but for some filetypes that might be where to look.

3 Likes