Windows – Is it possible to easily find the Command Prompt equivalent of a context menu item

cmd.execommand linecontext menuwindowswindows-registry

For example, Comodo Internet Security has added two items to my right-click menu, "Scan with Comodo" and "Run in Comodo Container." I don't particularly want both of them to be there clogging up my context menu; I'm never going to use the scan (I prefer Kaspersky for file scanning), and I'm rarely going to use the virtual desktop. What I'd like to do is disable them via registry (which I know how to do) BUT then put an item for "Run in Comodo Container" in my send-to menu. I already know how to add such items by creating a shortcut containing Command Prompt arguments in shell:sendto. However, I cannot figure out what those arguments should be to make it serve the same function as the original Comodo context menu item.

Does anyone know if there's a simple way to figure out the cmd equivalent of a context menu item created by an application? I'd like to be able to do this for several different apps' items, not just Comodo. I don't know if there's a universal way to essentially translate registry mumbo-jumbo into understandable cmd code, but Google has turned up nothing. Anyone know if this is possible?

Best Answer

This can get tricky because there are multiple places and methods to add a context menu item.

HKEY_CLASSES_ROOT in the Registry contains, among other things, context menu items and shell extension registrations. Some subkeys of that hive represent kinds of objects you see in Explorer. You might have to poke around to find where exactly your menu item is registered. Particularly interesting keys are:

  • * applies to all files
  • Directory applies to all directories when right-clicking on a folder item
  • The Background subkey of Directory applies to all directories when right-clicking in the background of the current folder
  • exefile applies to applications (EXE files)

Some of those subkeys have a shell subkey which contains subkeys for shell-specific registrations. Registrations with a command subkey represent context menu items. On my system, for example, AC3 files have a "Play with VLC media player" context menu item that comes from this branch:

  Subkey: ac3file
    Subkey: shell
      Subkey: PlayWithVLC
        Default value: Play with VLC media player
        Subkey: command
          Default value: "C:\Program Files (x86)\VideoLAN\VLC\vlc.exe" --started-from-file --no-playlist-enqueue "%1"

The default value of the command subkey is the command line invoked when the item is clicked. %1 gets replaced with the file/directory the item was used on. Relevant HowToGeek article.

Unfortunately, some don't have a command line, and are instead run through COM objects. Some context menu items don't have distinct Registry entries at all, and are instead added dynamically by shell extensions. Relevant shell extensions are under the shellex\ContextMenuHandlers branch of the file type key instead of shell. If clicking such items produces a new process, you might be able to use Process Explorer to see the command line used - just mouse over a process. If not, it may not be possible to emulate the menu item with the command line.