ixSci
ixSci

Reputation: 13698

Order in the Windows Explorer context menu

How can I change the order of the entries in the context menu?(e.g. for Directories) I need to know how Windows determines the order when showing that so I can control it. For example I want to place my custom action at the end of the context menu list

Thank in advance!

Upvotes: 15

Views: 22024

Answers (5)

Marc Wilson
Marc Wilson

Reputation: 140

I've been trying to find a way to re-order things, it irritates me that the daily use options are pushed to the end, when obscure utilities you might use once in a blue moon are filling up the top of the list.

I found a lazy way to do this, using a little utility package called "Windows 10 Manager" Windows 10 Manager - it's a few quid, but it's a lot easier than registry hacking. It can't do everything, but it does let you add items into the top section at least - and also to suppress cheeky ones that installed themselves in there without asking.Example showing amended context menu

As you can see, it's actually duplicated some entries rather than moving them, but never mind.

Upvotes: 0

244an
244an

Reputation: 1589

This is for Windows 7, maybe same for newer versions. It was inspired by the other answers, all is affecting the order.

I'm explaining entries for "*" (all files), but the same goes for special extensions.

I take no responsibility for any changes made in registry!

There are three sections in the context menu, as it says in How to Change the Order of Options in Context Menu (from answer by @Anonymouse)

They call them:

2 - Default menu position (at the top).
1 - Send to, copy to folder and move to folder menu part (in the middle).
0 - Rename menu part (at the bottom).

Within these sections the position is decided by the rules in answer by @Luke
The easiest way to change the order within the "section" is to change the name of the registry key under HKCR-*-shell or HKCR-*-shellex. All under subkey shell will be before them under shellex. Keys that have the CLSID as the key name will be as last entry since they are last in the used order.

As an example, I was following a sample from MSDN to build a Context Menu Handler
EDIT 2021-04-14: The MSDN link is no longer valid, it redirects to a "Browse code samples" page. You can search there for Context menu sample, but the one I followed seems to have been removed.
The closest to the old one I followed is perhaps this

The one I followed is using the CLSID as the name for the key under shellex, and a "friendly name" as default value. It was placed at the bottom of "section" 2 (top section). I changed the key name to something like Asample and changed the default value to be the CLSID instead. Now it was directly after entries under shell.

There are some more ways of changing the order.

For keys under shell you can add the value Position with string data Top or Bottom. Not possible to decide in what "section".

For keys under shellex the value Position has no effect. Instead it's possible to decide in what "section" the entry will be using flags, described in the link above.

  1. Use the CLSID for the shellext you want to move. It's like
    {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}. Get it either from the key name or the default value, it depends on how the entry is done.
  2. Find the entry under HKCR-CLSID, the key has the name of the CLSID.
  3. Add a value with name flags and data DWORD with the "section" number described above under the found CLSID.

Upvotes: 7

Anonymouse
Anonymouse

Reputation: 945

This did it for me... Steps 4 through 7 - setting the "flags" http://techoqueries.blogspot.de/2012/08/how-to-change-order-of-options-in.html

Upvotes: 3

Bin TAN - Victor
Bin TAN - Victor

Reputation: 362

This Q&A shows a simple way to CREATE (not move) an item within the context menu. I managed to duplicate an existing item. Then I moved my item to a higher and more accessible position within the context menu, by renaming the key to start with something "aMyItem" or "0MyItem".

Upvotes: 3

Luke
Luke

Reputation: 11421

My Google-fu led me to this:

So the sorting is based on the following elements in decision order:

  1. Key priority (eg, txtfile, *, AFSO)
  2. Registry Enumeration order of shellex\contextmenuhandlers with a special case for static verbs always being first
  3. IContextMenu Implementation order

So if there is any contention for position, there is no consistent way for an extension to guarantee their relative position within the menu.

Obviously you can't do anything about phase 1. Phase 3 only applies to the verbs implemented in your handler. That leaves phase 2. The only thing you can do is name your entry under ContextMenuHandlers such that it would be enumerated first, but nothing's stopping someone else from doing the same thing.

Upvotes: 14

Related Questions