Windows Search for exact filename and extension only
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?
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
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:
~"* (?).*"
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
.
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/