5

Is there any way to open a windows explorer window with the contents already filtered as if you'd entered them into the search window in the corner?

So I'd like to type directly into the Start Menu or a WinKey+R run menu as shown below then press Enter:

start menu

Ideally I'd get the following result:

example result window

I've tried looking through command line options for explorer.exe but haven't turned up anything to do exactly what I'm asking.

The aim of my question is to figure out if there is an existing command line or something but I'm willing to write an app or script of some sort if there's nothing out there--so any hints as to the APIs I might look at are welcome.

Windows 7 is the minimum platform I'm worried about getting this to work on.

4

Next to Organize in your screenshot, you can see the Save search button. That will allow you to save the search using your preferred name to:

C:\Users\<username>\Searches\<searchname>.search-ms

If you run this file from the Run dialog or even the command line, Explorer will open up and the search will auto-execute, displaying the results you want. (The search box will not be populated though with the search terms.)

  • 1
    Great, thank you! I'd just found this option in another old post a minute before you answered. It looks like I can decipher the .search-ms text file so it's possible to write a program to automatically generate the file and open the new window from the 'Run' box without additional steps/clicks! – nvuono Nov 4 '12 at 1:46
  • 1
    Yup, should be easy enough to programmatically generate, and you can find detailed info. about the XML format here. – Karan Nov 4 '12 at 1:52
  • 2
    got something basic going that takes 1 argument... "QuickSearch C:\location*.xyz" and I'll probably throw it in the path somewhere as qs.exe github.com/downloads/nvuono/ExplorerQuickSearch/QuickSearch.exe – nvuono Nov 4 '12 at 6:20
  • Oh very nice indeed! (github.com/nvuono/ExplorerQuickSearch for those looking for the code) – Karan Nov 4 '12 at 15:51
1

you can focus the location bar in a search window and you'll see a kind of 'URL' with some clues to write your own.
location bar in explorer search Something like this (in spanish):
search-ms:displayname=Resultados%20de%20la%20búsqueda%20en%20fotos&crumb=extensióndearchivo%3A~<*.jpg&crumb=location:F%3A%5Cfotos

This would search *.jpg files in F:\fotos path. Note those displayname, crumb tags.

You could write a .bat file accepting some parameters to compose a custom (simplified) URL and invoke it using Windows+R.
Typing explorer "double quoted url" will pop up a new explorer window with that search.

I'm sorry but I don't know how to convert slashes or spaces to URL friendly codes like %3A, %20 using cmd, but sure a simple string replace would work.

0

The URL has to be supplied to Internet Explorer rather than Windows Explorer. VBA code below:

sCmd = "search-ms:displayname=Search%20Results%20in%20iPhoneSample&crumb=name" & _
"%3A~""*[*2602_Australia_Australian%20Capital%20Territory_Downer*].*""%20OR%20name%3A~""        " & _
"*[*2602_Australia_Australian%20Capital%20Territory_O'Connor*].*""&crumb=location:C%3A%5CUsers%5CSimon%5CPictures%5CiPhoneSample"

Set objApp = CreateObject("InternetExplorer.Application")
With objApp
    .Visible = True
    .Navigate URL:=sCmd
End With

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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