22

I found out that at windows folder search the letter dash - works as eliminating the following word from search results.

However I have files that contain dash -. How can I search for them them?

For example: I have a file named my-home.png

I am using Windows 8.1.

I found the following documentation:

Here’s a list of AQS operators that have to do with text searching:

NOT/- : Both “not” as well as prefixing a dash will tell your search to exclude items that include the following term.
AND/+ : Both “and” as well as prefixing a plus sign will force your search to only include items that match for both terms.
“” : Using quotes will force a search to filter for an exact phrase.

enter image description here

7 Answers 7

20

How can I find files in Windows Explorer where the name contains -?

The following search expression will match all files that contain a - character:

~*-*

Explanation:

  • ~ literal match

  • * wildcard match

  • - match the -

  • * wildcard match

So ~*-* will match all filenames with any characters before a literal - and any characters after a literal -

You can also " the search expression, so

"*-*"

will also work.

6
  • 4
    Is there a reference for how to properly use the windows search box? My god, it drives me absolutely BONKERS trying to figure it out. Jun 1, 2017 at 4:27
  • @WayneUroda Read the series starting with Lesson 1: Stop Hunting and Start Finding!
    – DavidPostill
    Jun 1, 2017 at 8:25
  • Better link directly to the article: docs.microsoft.com/en-us/windows/desktop/lwef/…
    – Chad
    Aug 9, 2018 at 5:52
  • I wanted to find all files that I had made a copy of. So windows will suffix those with a "- Copy" before the extension. I found that I needed to use the ~ and the quotes to make this work. And I also made sure it only focused on the name. So, this worked for me... name:~"- Copy" Oct 22, 2019 at 16:27
  • 1
    @Chad good link, but only applies to WDS 2.x which is deprecated. To the people reading this, see Joseph Kingry's answer for the reference doc for WDS 3.x which is current as of 2022-06-22.
    – mach128x
    Jun 22, 2022 at 14:34
5

I had a similar problem with a file named hello-world. So if I tried searching only the word hello the file could be found. If I tried searching the word world the file is not found. In my search I did not use the -. However there seems to be some problem if the filename contains a -.

After trying to change indexing options and other complicated stuff the best solution I found was to search with a *.

So for example the search term *world finds my file. For now on I will be searching only with the *.

2
  • 1
    That should be the accepted answer.
    – Ini
    Nov 18, 2022 at 17:06
  • This answer is great, but windows search is f'ing terrible :/ Mar 10, 2023 at 19:04
3

Here is the reference I finally found for the AQS (Advanced Query Syntax), the default syntax used by Windows Search.

https://docs.microsoft.com/en-us/windows/win32/search/-search-3x-advancedquerysyntax

For example, if I have files like:

c:\temp\xyz-abc-001.jpg
c:\temp\xyz-abc-002.jpg
c:\temp\xyz-abc-003.jpg

I can use

System.FileName:~<"xyz-abc-"

Where ~< is the COP_VALUE_STARTSWITH operator.

1
  • This had the benefit of being faster on my super large file count remote shared folder Jan 13, 2023 at 17:41
1

Had same problem searching for numbers in filenames followed by dash - character
This seems to work

~="4000-1"
0

I have had similar issues. At work I have file names such as snstore-surv-nyc-10-mobile.

What works is using the * character to expand the search

Example:

snstore*nyc or 
snstore*mobile

Unfortunately I haven't found a way of expanding the search to three variables

snstore*nyc*mobile
0

Its work for me,

I have a lot of file using dash, i.e: ff-0101-12345, ff-0102-12345, ff-0000-12356

When i tried type in the search bar only 123, that will show nothing in the search result. It work fine when i type * before word that i will looking for. Like *123 so it will show search result that match --> ff-0101-12345, ff-0102-12345, ff-0000-12356

0

I wanted to find filenames containing the hyphenated string, eg "hyphenated-name". I dropped to a command prompt:

dir /s "hyphenated-name"

You must log in to answer this question.

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