4

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?

1
  • I don't know anything about this topic, but it seems like using supported mechanisms for this is better than poking at registry stuff, which might change from release to release. Have you looked into writing a shell extension? Commented Mar 6, 2010 at 22:45

2 Answers 2

6

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.

Sign up to request clarification or add additional context in comments.

Comments

-1

Try using this tool:

http://www.nirsoft.net/utils/shexview.html

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.