New Bottle Old Wine: Shell Context Menu

Life became very easy long back when windows offered Context menu on its shell objects like Files, Folders etc… Generally IContextMenu and IShellExtInt are used along with COM implementation to get the context menu functionality. However Registry entry can also be used to achieve this.

[HKEY_CLASSES_ROOT\Directory\shell\cmd]
@=”Open Command Window Here”

[HKEY_CLASSES_ROOT\Directory\shell\cmd\command]
@=”cmd.exe /k \”cd %L\””   are 2 very useful registry entries to attach new ‘Open Command Window Here’ command with all Folders.

 

Similarly  to achieve something on text Files,

[HKEY_CLASSES_ROOT\txtfile\shell\<My Command Text>\command]
@="abc.exe"

But what if you wanted the files command to work on selected set of files only OR say only on a particular file like XYZ.Txt only?

[HKEY_CLASSES_ROOT\.txt\shell\<My Command Text>]
"AppliesTo"="System.FileName:=XYZ.txt"

this entry in registry will work on xyz.txt file only.. 

Programming is interesting!!

 

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s