Don't Overlook Windows 2000's Built-in Search Engine

Windows 2000's built-in search engine has powerful search definition tools.

David Chernicoff

February 28, 2001

4 Min Read
ITPro Today logo in a gray background | ITPro Today

Searching through your hard drives has become more of a concern as the size of those drives routinely exceeds 20GB, even with notebook computers. Desktop systems with 100+GB of storage are common, and keeping track of all of your files can be quite an adventure. I'm always looking for files that I know I have somewhere, especially zip files, application installers, and, unsurprisingly in my line of work, Microsoft Word documents.

Windows 2000's built-in search engine can handle most of my searches. If you've never looked at the options available in this little search application, you're missing out on some pretty powerful search definition tools.

The Date option lets you search for files based on when you created, modified, or accessed them. The Type option lets you select any registered file type, which comes in handy if you remember the file's icon type but not the application you created it in; this option displays the registered file types and their icons. The Size option lets you specify a size range for the hunted file. And the Advanced options lets you search subfolders (selected by default), use a case-sensitive search, or if you're searching file content, search slow files.

I often find myself trying to find files that contain information about a specific topic, usually within Word documents or text files that contain notes I've taken. Although the Win2K search application can search for text within files, the command line has two ways to quickly search through files. The first is the FIND command:

FIND [/V] [/C] [/N] [/I] "string" ][path]filename[ .../V  Displays all lines that DON'T contain the specified string./C  Displays only the count of lines containing the string./N  Displays line numbers with the displayed lines./I  Ignores the case of characters when searching for the string."string"  Specifies the text string to find.[drive:][path]filename  Specifies a file or files to search.

If you don't specify a path, FIND searches the text typed at the prompt or piped from another command.

FIND is very fast, and it's useful if you're looking for a simple expression in a known group of files. But when I need a complex search that lets me search entire directory trees for files that contain something I can't quite remember (the "I know it said something like xxx" search), I use the FINDSTR command:

FINDSTR [/B] [/E] [/L] [/R] [/S] [/I] [/X] [/V] [/N] [/M] [/O] [/P] [/F:file][/C:string] [/G:file] [/D:dir list] [/A:color attributes] [strings] ][path]filename[ .../B  Matches a pattern if at the beginning of a line./E  Matches a pattern if at the end of a line./L  Uses search strings literally./R  Uses search strings as regular expressions./S  Searches for matching files in the current directory and all subdirectories./I  Specifies that the search isn't to be case-sensitive./X  Prints lines that match exactly./V  Prints only lines that don't contain a match./N  Prints the line number before each line that matches./M  Prints only the filename if a file contains a match./O  Prints character offset before each matching line./P  Skips files with nonprintable characters./F:file  Reads file list from the specified file(/ stands for console)./C:string  Uses specified string as a literal search string./G:file  Gets search strings from the specified file(/ stands for console)./D:dir  Searches a semicolon-delimited list of directories/A:attr  Specifies color attribute with two hex digits. See "color /?"strings  Text to be searched for.[drive:][path]filename  Specifies a file or files to search.

Use spaces to separate multiple search strings unless the argument is prefixed with /C. For example, "FINDSTR 'hello there' x.y" searches for "hello" or "there" in file x.y. "FINDSTR /C:'hello there' x.y" searches for "hello there" in file x.y.

Regular expression quick reference:

.  Wildcard: any character*  Repeat: zero or more occurrences of previous character or class^  Line position: beginning of line$  Line position: end of line[class]  Character class: any one character in set[^class]  Inverse class: any one character not in set[x-y]  Range: any characters within the specified rangex  Escape: literal use of metacharacter x  Word position: end of word

For more information about FINDSTR regular expressions, refer to the online Command Reference.

I usually create a FINDSTR search using Notepad and save it as a batch file with the results redirected to a file that I can then search through. This approach lets me create very complex string searches to sort through the hundreds of Word documents I've stored in multiple folders in the same directory tree. When you've been writing for a living as long as I have, this search can be incredibly useful.

So, if you're a Web developer, writer, or anyone that works with lots of text files and document files (though all of these commands can also search for text in binary files), I'm sure you'll find these command-line options useful.

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like