54

While searching for Windows.h, I discovered some rather annoying search behaviour on Windows 10. Rather than being presented with a single result of Windows.h, I was presented with an entire laundry list of files with "Windows" in them and "h" in them, which is not what I wanted. Searching for "Windows.h" did not help.

How can I search for Windows.h and receive only files with exactly that name?

enter image description here

Stephen Rauch
  • 3,091
  • 10
  • 23
  • 26
xaav
  • 765
  • 1
  • 5
  • 13
  • 7
    I have attached a picture that shows that Windows.h is present, but I do not want to see all of the other results. – xaav Jan 02 '17 at 00:18

3 Answers3

83

If you want to match only filenames and not file contents, you can qualify the search with name: like:

name:Windows.h

If you want an exact filename match, you can qualify the search with name:= like:

name:=Windows.h
Stephen Rauch
  • 3,091
  • 10
  • 23
  • 26
  • 8
    Note that the term `name` is translated to the system language. You can figure out your language's term by changing the view to "detailed list", and check the name of the column for file name. Example in Swedish, it says "Namn", so you type `namn:=`. – Liggliluff Jun 14 '19 at 09:42
  • 6
    This works with other explorer items as well, I just found I could use `extension:=.h` to find all .h files regardless of name. – PeterJ Nov 08 '19 at 05:12
  • 3
    Is this documented within Windows? – Charlweed Jan 13 '21 at 01:58
  • created:today, can also be very handy. Can be mixed with others such as name:cpp* etc – TheTechGuy Apr 07 '23 at 15:41
  • filename:Windows.h also seems to work, although there might be some difference that I don't know – Jeff Brower Jul 16 '23 at 23:59
10

If you need to search for specific files, which includes special characters, such as (, ), spaces and numbers in between, then you'll need to tilde + quote it.

For example, this is a wildcard search for all duplicated filenames, with any extension, that Windows has added (0-9) before the dot:

~"* (?).*"

enter image description here

Note that ? will catch any single character, not just a digit, so above example will also find files/directories that have a space + any single character between parentheses + dot. For example: My Directory (A). with a dot.

Noam Manos
  • 1,804
  • 1
  • 20
  • 20
3

I found quotes are necessary to do this.

name:"Windows.h"

If this does not work, one may try:

name:"Windows" ext:"h"

This syntax seems, to me, to have changed recently, either with Explorer or Office applications, and so searching the internet for this has been cumbersome, speaking for myself. Thanks for your inputs.

Using Windows 10 (10.0.17134 Build 17134)

Thanks to u/hudson4351, Reddit. https://www.reddit.com/r/Windows10/comments/g9s2uk/how_to_search_for_exact_match_in_file_contents/ https://www.reddit.com/user/hudson4351/

P.Coltharp
  • 352
  • 1
  • 2
  • 14