Archive for February, 2008

Windows XP Search For Words In .cs Files

Posted in Windows on February 13, 2008 by sidersdd

One thing that has always drove me nuts with Windows XP is the default behavior of the “search for a word or phrase inside a file” options with Windows Search.  Out-of-the-box it won’t search files like C# code files (*.cs).  Even if you explicitly specify them in the search dialog.

SearchInFiles

Apparently this is for “performance reasons.”  There is a finite list of file types that Windows XP Search will truly search.  A bit more work is involved to get the search to peer into cs, csproj, sln, etc. files.

A while back I discovered that you could manually get these additional file extensions added to the list of file types that Search would search, by making some modifications in the registry.  You could add a PersistentHandler key to the file extension entry in HKCR, and set the Default string value to a GUID that represented the plain text file filter.

PersistentHandlerRegistry

Today I learned there is another way (much easier) to allow all file types to be searched.  It involves setting the “Index files with unknown extensions” option as part of the Windows Search Indexing Service.  You don’t actually need to turn on the indexing service, but you get to the property through the indexing service dialogs.  Complete step-by-step instructions can be found in Microsoft Knowledgebase Q309173.

IndexFileWithUnknownExtension