It looks like Explorer search treats quotation marks like Google search's exact match where a search for "foo bar" ignores results like "bar the foo" so you only get results like "the foo bar."

But having hyphens like foo-bar confuses it.

For example, in a folder with these contents:

enter image description here

Filename-only search does not work correctly:

enter image description here

Nor does contents-only search:

enter image description here

How can I use Windows Explorer search to behave consistently? Abandon it for the Command Prompt?

  • You might try a third-party tool, such as indexed DocFetcher, or real-time Agent Ransack. Both offer regexp for filenames, but AgentRansack uses regexp (and other criteria) for searching contents. Aug 19, 2019 at 17:18

1 Answer 1


For filenames, Query Operators can offer some help: name:~~"foo-bar" should give you the results you want: enter image description here

But content search doesn't seem as well behaved. Created two files, one with content "foo-bar", the other with content "foo bar". The following attempts returned both files:


While content:~~"foo-bar" returned none!

So, for accurae content searching, I would go with PowerShell and the Select-String cmdlet:

enter image description here

There's definitely a learning-curve, but with support for regular expressions, it's a very powerful tool.

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.