How to determine possible Context Menu Parameters for Class Types

Created: 2009-09-09
Modified: 2009-10-25


You are trying to create a Context Menu for a particular class by editing the registry directly.  As part of the Context Menu you may need to pass information to the menu selection to issue the desired function or command correctly.



There are many Context Menu handlers and all may pass information using different variables.  While you can research the individual Context Menu handlers to find the documented variables it may be easier to discover them on your own.



To discover parameters for the class type (File, Folder, Network, PDF, DOC, etc) create a batch file in %SystemRoot% similar to the following.


@Echo Off

Echo 1=%1

Echo 2=%2

Echo 3=%3

Echo 4=%4

Echo 5=%5

Echo 6=%6

Echo 7=%7

Echo 8=%8

Echo 9=%9



You should then initiate the menu option from the object specific Context Menu launching (one at a time) the four commands below.  This will discover all the variables used by the specific Context Handler for you.

CMenuTest.bat %1 %2 %3 %4 %5 %6 %7 %8 %9

CMenuTest.bat %a %b %c %d %e %f %g %h %i

CMenuTest.bat %j %k %l %m %n %o %p %q %r

CMenuTest.bat %s %t %u %v %w %x %y %z %0


Output Example for a Context Menu created for a Network Class object (HKey_CLASSES_ROOT\Network)


The only meaningful variable for the example Network Class appears to be %D which is the \\Servername.  Other variables of unknown value and meaning are %H, %I, %L (appears to be skipped in screenshot), and %S.


More Information:

Common Context Menu Parameters

%L = Long File Name (LFN) when used with Files and Folders

%1 = Either LFN or Short File Name (SFN) when used with Files and Folders

%I = IDList (internal windows structure used only by explorer) another way of identifying a file,

but valid only while a particular folder window is open.

%0 = actual program name


Common DDE Parameters

 %S = show command (maximize, minimize, etc.)

 %H = hotkey

Article ID: 192, Created On: 9/18/2011, Modified: 9/18/2011