I would like to add an entry to the context menu for folders, but only have it show in the context menu IF the folder in question contains files of a certain type (in this case, only if the folder contains .avi files). Is this possible?

I'm sure I've seen at least one program which only had its context menu entry shown in certain folders - though I can't for the life of me remember what it was.

link|improve this question
feedback

2 Answers

It's certainly possible to write a context-menu handler whose entry that will only show up in the menu if certain files exist in the directory. A context-menu handler is a program that is free to decide whether to show up or not, although this might slow down the appearance of the context-menu for folders.

The only general mechanism in Windows for this to happen is Windows Search Advanced Query Syntax. One of the new features in Windows 7 is the addition of the "AppliesTo" value for static context menu items. This lets a static item be shown or hidden based on the result of an AQS query.

In this example, the DefaultAppliesTo value makes this verb the default for any file with the word "exampleText1" in its file name. The AppliesTo value enables the verb for any file with "exampleText1" in the name. The HasLUAShield value displays the shield for files with "exampleText2" in the name.

HKEY_CLASSES_ROOT
   txtile
      shell
         test.verb
            DefaultAppliesTo = System.ItemName:"exampleText1"
            HasLUAShield = System.ItemName:"exampleText2"
            AppliesTo = System.ItemName:"exampleText1"

As AQs is not well-documented, I haven't been able to find the syntax for querying a folder's content.

link|improve this answer
feedback

Filemenu Tools will let you do this, at least within it's own context menu.

link|improve this answer
Unfortunately, this doesn't do what I'm looking for. It lets me add things to the context menu for files of a certain type, ie I can show an entry when I right click on .avi files - that is not quite what I'm after though. What I want to be able to do is right click on the folder containing the .avi file, and have the entry on that - and only have that entry there for folders that contain .avi files. – MailSlut Sep 3 '10 at 7:15
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.