2

In Windows 10, the behaviour of the standard file search, activated by pressing the Windows key Win, has completely changed with respect to Windows 7. It generally gives unsatisfactory and incomplete results as nicely illustrated e.g. in this PCGamer article.

One could use alternative free search tools like e.g. the higly regarded EVERYTHING software. However, I find that the search box of File Explorer already does exactly what I want. In fact the File Explorer search box returns results that are generally the same as EVERYTHING (see an example below), and it is equally fast. In addition File Explorer efficiently indexes and searches the content of files. For this reason I would like to use File Explorer for my standard file searches instead of third party products.

File Explorer vs. EVERYTHING search of full Miniconda folder

The small problem is that I use search constantly in my workflow, and it takes two hot keys to Win+E open File Explorer and Ctrl+F to focus on search. Moreover, this approach keeps opening new File Explorer windows, instead of reusing open ones.

Can somebody think of a simple way to have a single global hotkey, which:

  • opens File Explorer, or brings it to the foreground if already open; and
  • set the focus to the search box, so one can immediately start typing

to search for files?

  • Yeah, I searched and saw that after commenting. Deleted. Thanks. :-) – Ken White Apr 27 '17 at 13:18
3

If you are amenable to using a third party program...

Use AutoHotKey, which can combine keystrokes or hotkeys

The docs are quite readable, but this should get you started by binding Ctrl+F9 to focusing search in Explorer.

File explorersearch.ahk:

Open explorer and focus search

^F9::
    Send, #e
    WinWaitActive, ahk_class CabinetWClass
    Send, ^f

Re-use explorer window

Or, a more involved one that uses WinExist to check if Explorer is open, and WinActivate to focus it:

^F9::
if WinExist("ahk_class ExploreWClass") or WinExist("ahk_class CabinetWClass")
{
       WinActivate
       Send, ^f
       return
}
else
    Send, #e
    WinWaitActive, ahk_class CabinetWClass 
    Send, ^f

(thanks to JayG's answer at SO for the ahk_class used by explorer as I don't have Windows booted at the moment)

Where: # is the Windows key and ^ is the Ctrl key. WaitWinActive will wait until the Explorer window has focus (thanks to divenex for the suggestion, which replaced Sleep). Additionally, you could probably replace the first line with Run, explorer.exe for the same effect; but this does what was literally asked in the original question.

With AutoHotKey there is a huge scope for customisation and automation- it's worth reading through the tutorial, and you'll probably want to keep a note of the key and modifier list handy too.

  • Thanks. This partially answers the question, but I would also like the hotkey to reuse the File Explorer window if it is already open, rather than opening a new one. Is that possible? FYI, this can be done when using the EVERYTHING program for the search. – divenex Apr 27 '17 at 11:51
  • @divenex Thanks for the heads-up; I have updated the answer to include an example that reuses the window if it exists – bertieb Apr 27 '17 at 12:16
  • Perfect! Precisely what I wanted. Thanks a lot. There is just a small bug: the ^F9:: needs to be at the beginning of the whole script, or it complains about duplicated hotkey – divenex Apr 27 '17 at 12:32
  • @divenex My pleasure :) Good catch, that bug crept in while moving things around! – bertieb Apr 27 '17 at 13:03
  • 1
    For extra robustness, you may replace sleep 100 with WinWaitActive, ahk_class CabinetWClass – divenex Apr 27 '17 at 14:08

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.