How do I launch the Explorer Search window with specific search criteria?

A customer wanted to know how to launch Explorer's Search window with specific fixed search criteria. It turns out that there are two ways of doing this, the poor man's way and the overachiever's way.

The overachiever's way is actually easier to discover. You can use the search-ms protocol to generate a command string that describes the query you want to perform and pass it to Shell­Execute.

The poor man's way actually requires a little bit of out-of-the-box thinking: Open the Explorer Search window and interactively create the query you want to be able to relaunch later. Now do File, Save Search, and save the query. When you want to relaunch the query, execute the saved search. This is, after all, how end users save and re-use searches.

Comments (13)
  1. blah says:


  2. John says:

    This is totally off-topic, but I just discovered that the maximum timeout for InitiateSystemShutdown is 10 years.  Now my question about a boot menu timeout of 128 days doesn't sound so dumb, does it?

  3. Nick says:

    What?  No launching Explorer and then SendKeys your way to glory?  I thought that was the normal way to automate tasks in Windows.

    I'm disappointed.

  4. Francis says:

    Another overachiever's way would be to reverse engineer the saved search file format and create a program that can generate searches with custom arguments.

  5. Lawrence says:

    Francis: that's not the overachiever way, that's the "I haven't really thought this through" way.

  6. @francis – Why reverse engineer the file format when the protocol is documented?

    Option #3:  Do the search in Explorer, then click in the address bar and copy the address, which will be a search-ms URI :)

  7. Julian says:

    Why does the search box provide no way to search locations by environment variables? The "folderpath": filter (which isn't mentioned in the AQS syntax page) doesn't accept environment variables like %windir%, %userprofile% or %tmp%. The XP search in/look in field accepted environment variables. Sure I can type %userprofile% into the Run box and then search but that's just one folder at a time. How about helping the user so he doesn't have to type long paths?

  8. Anonymuos says:

    GUI GUI GUI! Too bad there's no GUI to *BUILD* the search for the poor man. That's what makes the search cumbersome to use. I refuse to remember the Advanced Query Syntax. The poor man requires referring to the AQS page that sadly isn't even in the offline documentation. That and your real time search is slow compared to XP/2000. Indexer and indexed search is awesome. Another problem: the Windows Search addin to index UNC paths hasn't been updated (laziness) to work with Windows 7 from Vista. Only the Win+F window shows more search filters (though not all) and regular Explorer windows show only "Date Modified" and "Size". I expect a GUI to build to search in the next Windows release please and a faster real-time search.

  9. Drak says:


    how many non-it-professionals know about %windir%?

    I guess it's all about balancing time taken and possibility of bugs against the greatest amount of general use the feature will get.

  10. Nick keighley says:

    I guess I must be dim. I don't seem to have a "Save Search" option under my File menu. I also don't end up with anything interesting in my address bar after a search.

  11. Leo Davidson says:


    How many non-IT-professionals know about AQS in the first place?

    I'd say we're already talking about fairly technical users if we're talking about typing AQS queries by hand (at least queries beyond trivial "just type a word into the box to find that word" cases where the user may not be aware AQS exists or is in use).

  12. @Leo says:

    Point taken

  13. @Drak says:

    Plus, it is a regression, is it not. It was doable in the earlier one, not in a later release. Why as a user should I care how they manage their time? Features are not *supposed* to be lost just like that in an "upgrade" esp when you trumpet your shiny new product is a million times better than an antiqated OS.

Comments are closed.

Skip to main content