Revisit Past: Windows 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!!