Reputation: 2984
I'm currently writing an application where I need to modify the context menu of windows explorer so that I can call a method within the application to be used on all files/folders that are seen in windows explorer.
As there are already quite a few posts on stackoverflow (and also tutorials) on how to add the context menu for specific file types I know already that that is done usually by assigning the application to the right parts of the registry entry for those file types.
As I don't want to limit myself to only specific filetypes my question is: IS there any way to assign this new context menu item to ALL filetypes (aside from going through each registry entry beginning with . and assigning the application to them there)?
Upvotes: 6
Views: 11257
Reputation: 175766
Yes, the *
class:
Create the key:
HKEY_CLASSES_ROOT\*\shell\Open with MyThing
Create the sub key:
HKEY_CLASSES_ROOT\*\shell\Open with MyThing\command
Set the default value to your command line:
C:\foo\myThing.exe "%1"
(You can add fixed values here also: C:\foo\myThing.exe "%1" /ranfromshell
)
To set an optional icon create the string value Icon
in:
HKEY_CLASSES_ROOT\*\shell\Open with MyThing
You can put the path to an icon, dll or exe here - Windows will extract the appropriate icon & display it.
For:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\*\shell\Open with MyThing]
"Icon"="C:\\foo\\myThing.exe"
[HKEY_CLASSES_ROOT\*\shell\Open with MyThing\command]
@="C:\\foo\\myThing.exe \"%1\""
Upvotes: 14