{"id":92822,"date":"2016-01-11T07:00:00","date_gmt":"2016-01-11T22:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/?p=92822"},"modified":"2019-03-13T10:28:46","modified_gmt":"2019-03-13T17:28:46","slug":"20160111-00","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20160111-00\/?p=92822","title":{"rendered":"Creating a shell extension that applies only to files with a very specific name"},"content":{"rendered":"<p>Today&#8217;s Little Program isn&#8217;t even a program. It demonstrates how to register a shell context menu command that applies only to files with a specific name. <\/p>\n<p>Let&#8217;s say that you want a special context menu command, let&#8217;s call it <i>Party!<\/i>, on any file called <code>party.txt<\/code>. If invoked, it runs CharMap because everybody knows that CharMap is a total party animal. <\/p>\n<p>Now, if you wanted the command to apply to any text file, you would use the following registration: <\/p>\n<pre>\n[HKEY_CLASSES_ROOT\\txtfile\\shell\\Party!\\command]\n@=\"charmap.exe\"\n<\/pre>\n<p>But this offers the <i>Party!<\/i> command on humorless files like <code>readme.txt<\/code>. <\/p>\n<p>Fixing this is a special case of <a HREF=\"http:\/\/blogs.msdn.com\/b\/oldnewthing\/archive\/2013\/02\/07\/10391707.aspx\">getting dynamic behavior for static verbs by using Advanced Query Syntax<\/a>. In this case, we create an Advanced Query Syntax filter that selects an exact file name. <\/p>\n<pre>\n[HKEY_CLASSES_ROOT\\.txt\\shell\\Party!]\n\"AppliesTo\"=\"System.FileName:=Party.txt\"\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>The AppliesTo tag.<\/p>\n","protected":false},"author":1069,"featured_media":111744,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[25],"class_list":["post-92822","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>The AppliesTo tag.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/92822","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/users\/1069"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/comments?post=92822"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/92822\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media\/111744"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media?parent=92822"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=92822"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=92822"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}