15

It seems that Windows Search is having trouble when I specify a question mark character as the content that I'm searching for within my files.

I've tried:

  • content:?
  • content:"?"
  • content:"\?"
  • content:\?
  • content:%3f
  • content:"%3f"
  • content:\3f
  • content:"\3f"
  • content:\00\00\00\3F

but each of these yield no results when I do indeed have files that contain ? within the scope of the search. If I instead search for something like content:happy it will indeed find all files with the phrase "happy" within those same files.

My assumption is that Windows Search is treating some characters such as the question mark as a special character likely for the purpose of wild card expressions. To test this theory I've also searched for files containing an asterisk * and indeed I have the same issue as when searching for content of question mark. What I'm wondering is whether there is any way to get a search to work where I can search for a literal expression without any type of wildcard matching or at least a way to escape the special characters within the expression.

By the way I'm using Windows 7 Enterprise.

12

Try ~=? where ? is the character you are searching for.

| improve this answer | |
  • 4
    Excellent! content:~=? worked beautify! Out of curiosity where did you get the idea of using ~= as an escape sequence? – jpierson Oct 21 '11 at 16:04
  • I'm trying to search for "my_string". It seems to be treating the underscore as a space or a comma or something, and showing me everything that contains either "my" or "string" or both. – Shavais Aug 5 '14 at 23:02
  • How will I be able to use this to search for files within a file? For example: content:"reports.asp" – John Odom Nov 24 '14 at 16:18
  • Windows search syntax has a lot of special characters in it, so you have to quote most of them to avoid them being interpreted. See msdn.microsoft.com/en-us/library/bb266512(v=vs.85).aspx. However, ? and *, quoted or not, are always interpreted as DOS wild cards. * for all characters, ? for 1 char. If you click on the Address Bar of windows explorer, you will see windows converts the search to the real query syntax. ? and * get interpreted as crumb=filename%3A~?%20OR%20System.Generic.String%3A? (cont.) below – Mr_Moneybags May 30 '18 at 23:23
  • This filename:~? means search as a DOS wildcard, filenames that START WITH any one character (essentially every file!). OR System.Generic.String:? means OR any file property/content that has a WORD that STARTS WITH literally ? My advice, read the AQS documentation, and click the Address Bar to see what Windows Search re-interprets the AQS to. Also note, by default, string file properties (Filename, author, etc.) By default search with WORD_STARTSWITH $<, so any word that starts with your search term. Other non-string properties (Dates, etc.) search with EQUAL = – Mr_Moneybags May 30 '18 at 23:38
6
+25

It looks like Microsoft has removed the ability to search just for special characters. In order to search with special characters there must also be a word included with it (Example: Who?). Again, there must be a word, not just a wildcard, with the special character. That is because Windows Search ignores the special characters with the exception of the wildcards?. Per this indows Search Tips and Tricks page, the only wildcards that available within Windows Search are asterisk and question mark. However, it seems that the only one that works is the asterisk. Even when trying its example, s?n, found on the same page page.

Here is quote from a post on Vista64's Forums: (Source)

Actually, the problem is a little different. Search is now word-based, not character based. Brackets are considered punctuation by Search, not wild cards. To get meaningful results, queries that contain punctuation must also contain words, a phrase, or a wild card. For example, If I search on this:[*] or this: {*} I get a bunch of files that have a phrase in their file name within brackets, just as I would expect. So give that a try.

| improve this answer | |
  • 1
    Unfortunately I don't think your explanation is entirely accurate. When I searched for content:"bark?" I match documents that have both bark? and just bark within them. So it looks like the punctuation is just plain ignored. – jpierson Dec 2 '10 at 22:03
  • Sir, right. That is what I said. From my answer: That is because Windows Search ignores the special characters with the exception of the wildcard. – SgtOJ Dec 3 '10 at 1:20
  • 1
    ... I didn't just tailor my answer to your issue with just question mark. Instead my answer explains what is going on will all special characters with the exception of the wildcard character -- the asterisk. Please note, I'm not saying there is one wildcard but that I have found that only the asterisk works as the wildcard. Please left me know if you find another so that my answer can be updated. – SgtOJ Dec 3 '10 at 1:34
4

In Windows 7 I had a similar problem only I was trying to search for keywords surrounded by square brackets ("[" was also ignored similar to "?", "(", "]", etc.) within the filename. What worked for me is the following:

filename:"*[Cumbia]*" OR filename:"*[Reggae]*"

This would find all my songs which I tagged with the text string [Cumbia] or [Reggae] within the filenames. What I would then do is select all the files and then right click on the selection to invoke the Sendto feature to send all the songs to my music player program (Winamp in this case).

| improve this answer | |
  • Excellent. Using filename instead of using content worked for me. I tried to filter duplicate files having file(1).jpg and file(2).jpg and used this expression filename: "*(1)*" and filename: "*(2)*". – Lucky Apr 17 '17 at 12:14
2

Try content: ~="?" or extension: ~="?" or whatever special character you are looking for in the quotations, etc.

| improve this answer | |
1

I do not use Windows Search, but I wonder if it supports escape characters as described in this Microsoft article :

Using the search Protocol

If it does, you might try using %3f for the question mark.

| improve this answer | |
  • I tried your suggestion and searched for %3f, content:%3f, and content:"%3f" but to no avail. I also tried combinations with wild cards but still no luck. Thanks for the suggestion anyways. – jpierson Dec 2 '10 at 21:45
1

Just use powershell to search file contents:

Get-ChildItem -recurse | Select-String -pattern "dummy" | group path | select name

| improve this answer | |
  • While not answering the question directly, this gave me exactly what I needed as an alternative, thanks! I need to learn more powershell. – Mark Adamson Aug 24 '16 at 12:26
0

I struggled with finding the "?" character in long lists of filenames. Windows 7 Search is a horrible product I don't usually use for numerous reasons but I could not get content: or any of the other suggestions to work either. Then I thought of this, problem solved in one minute flat...

Open a normal or elevated command prompt and navigate to the directory in question. Use the following DOS command to create a text file of the directory contents:

dir > files.txt

This will create a text file called files.txt with the directory listing. If you want to list all subdirectories use dir/s > files.txt. If you do this from the root it will list all files on your HD in one big text file.

Now, open the text file in an editor, I used Notepad. Search for the character in question, in this case "?". Now you can find the names of the offending files.

If there are a lot of files there has to be an easy way to automate this process although I am not thinking of it at the moment.

Finally I used 7-Zip freeware to rename the files. There has to be an automated way to do this too but I haven't found it yet. I have tried some freeware file managers but none so far let you search for "?" in filenames. At least that way they would all be in a list for easier renaming.

| improve this answer | |
-1

I've only found a few resources on the search syntax so I'll begin to list them here in hopes of finding one that may provide a solution or at least a workaround for my problem.

Windows Search: Tips and Tricks

Windows Search: Advanced Search Options

| improve this answer | |

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.