Search code examples
windowsregistrycontextmenu

Add a separator in the Windows Explorer context menu (not in a submenu)


I have found that "CommandFlags"=dword:00000040 will add a separator below an entry, though only to a submenu (under the "subcommands"="" string). Example here.

Is there a way to add a separator in the main context menu?

The example I am using:

[HKEY_CLASSES_ROOT\AllFilesystemObjects\shell\Delete With Rimraf]
@="Delete With Rimraf"
"CommandFlags"=dword:00000040

This gives no separator.


Solution

  • This example feature a separator after and before the item, this entry is for VirusTotal Uploader

    Windows Registry Editor Version 5.00
    
    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\vtuploader]
    @="Send to VirusTotal"
    "Icon"="C:\\Program Files\\VirusTotalUploader2\\VirusTotalUploader2.2.exe,0"
    "SeparatorBefore"=""
    "SeparatorAfter"=""
    

    For other applications loaded over shellex it's not possible to add separator over registry, the injected dll add/remove separator itself, you need then to change the dll code and recompile it to achieve what you want here is an example with notepad++ https://github.com/notepad-plus-plus/notepad-plus-plus/pull/3092/commits

    InsertMenu(hMenu, nIndex, MF_STRING | MF_BYPOSITION, idCmd++, m_szMenuTitle);