60

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

1
  • 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 2, 2017 at 0:18

3 Answers 3

89

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
5
  • 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, 2019 at 9: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 8, 2019 at 5:12
  • 3
    Is this documented within Windows?
    – Charlweed
    Jan 13, 2021 at 1:58
  • created:today, can also be very handy. Can be mixed with others such as name:cpp* etc
    – TheTechGuy
    Apr 7, 2023 at 15:41
  • filename:Windows.h also seems to work, although there might be some difference that I don't know Jul 16, 2023 at 23:59
12

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.

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/

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .