Custom Context Menu for folder conflict with windows default behaviour

Hi, I added a context menu for one of my programs for folders. Below is the structure I followed

 But after I do this when I right click folder icon on taskbar and click a folder it runs the my newly added command.. When I remove this whole Nnnl key or when it does not work.. Explorer opens the folder normally.

Answer
Answer

There are 2 workarounds. Include another subcommand (after cmd1) and it should be the last one under the cascading menu, with the command pointing to explorer.exe "%1". But this item will always show up in your cascading menu, if you don't mind.

Another option (which is perfectly clean) is that you implement it in AllFileSystemObjects rather than under Directory. Next, to prevent the menu from showing up for files, add a check like:

AppliesTo (REG_SZ) setting it something like "kind:folder" so that it shows up only for file system folders. With this done, Pinned items from File Explorer Jumplist work fine as well.

Here is a sample REG from my testing.

;- - -

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\AllFilesystemObjects\shell\CustomMenu]
"Icon"="notepad.exe,0"
"MUIVerb"="MyMenu"
"SubCommands"=""
"AppliesTo"="kind:folder"

[HKEY_CLASSES_ROOT\AllFilesystemObjects\shell\CustomMenu\shell\test1]
"Icon"="c:\\windows\\notepad.exe,0"

[HKEY_CLASSES_ROOT\AllFilesystemObjects\shell\CustomMenu\shell\test1\command]
@="notepad.exe"

[HKEY_CLASSES_ROOT\AllFilesystemObjects\shell\CustomMenu\shell\test2]
"Icon"="c:\\Program Files\\Windows NT\\Accessories\\wordpad.exe"

[HKEY_CLASSES_ROOT\AllFilesystemObjects\shell\CustomMenu\shell\test2\command]
@="wordpad.exe"

;- - -

It seems you were the first one to have found the bug. Hope the solution works.

______________________________________________________________________________________________________
Ramesh, Windows Shell MVP 2003-2012.
If this post resolves your issue, pls mark it as an Answer.

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

 
 

Question Info


Last updated October 11, 2023 Views 634 Applies to: