Creating cascading menus
In Windows 7 and later you can create static menus directly through the registry.
Because HKEY_CLASSES_ROOT
is a combination of HKEY_CURRENT_USER
and HKEY_LOCAL_MACHINE
, you can register any custom verbs under the HKEY_CURRENT_USER\Software\Classes
subkey. The main advantage of doing so is that elevated permission is not required.
Source: Creating Shortcut Menu Handlers
Registry template
Here's a per-user registry template you can use. Just paste it in a new text document, and apply the changes you need. Then save it as a .reg
file, and merge it to the registry. The custom menu will be added to all files and folders.
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Classes\*\shell\MyMenu]
"MUIVerb"="My menu name"
"Position"="Bottom"
"SubCommands"=""
[HKEY_CURRENT_USER\Software\Classes\*\shell\MyMenu\shell\cmd1]
@="Copy"
"AttributeMask"=dword:00000001
"AttributeValue"=dword:00000001
"ImpliedSelectionModel"=dword:00000000
"MUIVerb"="@shell32.dll,-31246"
[HKEY_CURRENT_USER\Software\Classes\*\shell\MyMenu\shell\cmd1\command]
@="copy command here"
[HKEY_CURRENT_USER\Software\Classes\*\shell\MyMenu\shell\cmd2]
@="Move"
"AttributeMask"=dword:00000002
"AttributeValue"=dword:00000002
"ImpliedSelectionModel"=dword:00000000
"MUIVerb"="@shell32.dll,-4145"
[HKEY_CURRENT_USER\Software\Classes\*\shell\MyMenu\shell\cmd2\command]
@="move command here"
[HKEY_CURRENT_USER\Software\Classes\Folder\shell\MyMenu]
"MUIVerb"="My menu name"
"Position"="Bottom"
"SubCommands"=""
[HKEY_CURRENT_USER\Software\Classes\Folder\shell\MyMenu\shell\cmd1]
@="Copy"
"AttributeMask"=dword:00000001
"AttributeValue"=dword:00000001
"ImpliedSelectionModel"=dword:00000000
"MUIVerb"="@shell32.dll,-31246"
[HKEY_CURRENT_USER\Software\Classes\Folder\shell\MyMenu\shell\cmd1\command]
@="copy command here"
[HKEY_CURRENT_USER\Software\Classes\Folder\shell\MyMenu\shell\cmd2]
@="Move"
"AttributeMask"=dword:00000002
"AttributeValue"=dword:00000002
"ImpliedSelectionModel"=dword:00000000
"MUIVerb"="@shell32.dll,-4145"
[HKEY_CURRENT_USER\Software\Classes\Folder\shell\MyMenu\shell\cmd2\command]
@="move command here"
Remarks
- The
AttributeMask
value specifies the SFGAO value of the bit values of the mask to test with.
- The
AttributeValue
value specifies the SFGAO value of the bits that are tested.
- The
ImpliedSelectionModel
specifies zero for item verbs, or nonzero for verbs on the background shortcut menu.
Source: Creating Shortcut Menu Handlers
In the template above, the AttributeMask
and AttributeValue
are set to 0x00000001
and 0x00000002
, respectively. Those values are associated to the SFGAO_CANCOPY
and SFGAO_CANMOVE
constants, which determine whether the specified items can be copied/moved.
Further reading
1
For submenus you'd have to write a shell extension, AFAIK.
– user1686 – 2014-03-02T06:13:08.053What's the operating system you're using? – and31415 – 2014-03-02T11:17:49.940
A quick google search turned up some tools.
– Shazvi – 2014-03-02T14:07:53.747Here's one that uses regedit – Shazvi – 2014-03-02T14:23:37.897
I'm currently on windows 8.1 os @and31415 – Dharmik Patel – 2014-03-02T14:37:27.040
Can any one help me how to write shell extension in c# – Dharmik Patel – 2014-03-02T15:39:05.910