Manipulation of the right click context menu in windows shell

registry, windows-shell

Solution

To add a sub menu you will need first to add the menu name like:

[HKEY_CLASSES_ROOT\Directory\shell\Notepad]
"SubCommands"="command1;command2;"
"MUIVerb"="Notepads"
"Position"="-"

The sub commands are the the trick. each command is actually a reference to another registry entry.

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\command1]
@="command1"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\command1\command]
@="C:\\Windows\\System32\\cmd.exe"





[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\command2]
    @="command2"

    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\command2\command]
    @="C:\\Windows\\System32\\cmd.exe \K cd %1"

This will give you a sub context menu when clicking on the directory. you can use %1 in the command to get the name of the item clicked by the user. This is working for directories. Should work fine for files.

Problem

I have been trying to manipulate my right clicks inside windows, using the registry. I managed to add single lines inside the shell. ``` [HKEY_CLASSES_ROOT\Directory\shell\Notepad [HKEY_CLASSES_ROOT\Directory\shell\notepad\Command] @="\"notepad.exe" \"%1\"" ``` would launch notepad for example. Now, what I really want is a subdirectory inside the context menu though. Any one have any idea where I can read up on this, or have an idea how to actually do it?

Original source