Does Windows search for a word in a file work?

I’ve never got this to work right.

I use the File Explorer to go to a parent folder for my project. I hit the Search button, then explain I’m looking for "All files and folders. I put in “*.xml” for the file name, and “encrypt” for the word or phrase. (Both without quotes.) I tell it to search, and get no results.

Dropping to a Cygwin bash window and going to the same parent folder, I type:
find . -name *.xml -exec grep -l encrypt {} ;

I get a listing of the four xml files that contain the word encrypt. So what am I doing wrong in Explorer?

I’m using Windows XP.

I’m pretty sure all Windows Explorer search does is search filenames. I remember a search option inside MS Word a long time ago that would search inside files for text strings, but that was a long time ago.

Ah, I found this: Microsoft Support

(emphasis added)

Possible solutions at the link.

This guy said method 2 worked for him.

Neither of those methods actually worked for me. The “With Indexing Service (for faster local searches)” simply doesn’t appear to me, though I definitely have a newer service pack than the one from 2001 that they mention. Oh, well. At least I know now that this is another one of those “Windows and its wacky default settings” problems. I’ll just keep using Cygwin find. Thanks for the info!

Since XP is going out of support soon anyway, you might consider upgrading. Windows 7’s search indexer is much, much, much better.

Do you have indexing turned on? If not, that may explain the option not appearing.

I agree about the crappy Windows text search. I use cygwin as well. One improvement to your search is to use xargs like this:

find . -name *.xml | xargs grep -l encrypt

That way grep will only be run once for all the files instead of one time for each file.

I’ve never found Windows XP very reliable for searching inside files - not only does it skip right over some file types, it’s also pretty flaky about partial word searches (or something like that). If you search for ‘banana’ and it appears in the file as bigbendybanana, it might not consider that a match.

I installed PRGrep on my machine and I just use that instead - it’s better anyway, for all kinds of reasons.

That’s incredibly helpful. Thanks!
I do agree about upgrading XP, but it’s a work computer and so not my choice. There’s apparently some issues with the way Windows 7 interacts with our disk encryption. If it were my choice, I’d replace everything with Macs!

According to my C: drive properties, I do in fact have indexing turned on.

I have Windows Search 4.0 for Windows XP installed on my Windows XP PC.

It does successfully search Word docs, Excel docs, PDFs, Outlook email messages. I use it constantly for Outlook searches. However, it takes time to configure it to index properly.

The Windows findstr command is much more reliable and versatile than XP’s GUI search, and doesn’t require installing Cygwin.