Windows File Search

This booklet is on how to find files and search their content on Microsoft Windows computers. The subject terms include finding files on Windows.

edit

You can search by file name, creation and modification date, size and similar properties different from file content; such a search is usually much faster than content search.

The Windows Explorer search function enables search by file properties other than file content. That function includes the options to search by file name, date, and size. The detailed capabilities of the function depend on Windows version. The file name search available at the right top of a modern Windows Explorer window seems to make use of word boundaries; in it, a file name seems to match if the search term is the beginning of a word in the file name. To enable arbitary substring file name search, you can use asterisk (*) around the substring sought.

dir, forfiles and where built-in commands for the command line enable search by characteristics other than file content; see Windows Batch Scripting#Finding_files.

The find command known from other operating systems provides some additional features and is available e.g. from GNUWin32, but you should use it under the gfind name or else the Windows native find function gets used.

edit

You can search in the content of the files.

Plain text files are easy to search as described below.

Non-plain text files such as Microsoft Office documents and PDF documents are harder to search. Modern Windows contain an indexing system and system of plugins into that indexing system that make it possible to perform content searches on a variety of document types.

Plain text

edit

To search in plain text files, you can use the Windows native tools for the command line: dir, findstr (regular expressions supported), forfiles and where. See Windows Batch Scripting#Finding_files. Other tools listed below require installation.

You can use grep known from other operating systems and noted for regular expression support.

You can use Notepad++[1] (GNU GPL V2+), whose Find in Files function is under Control + Shift + F and supports search in UTF-8 files as well as regular expressions.

You can use grepWin to obtain a GUI support for regular expression search including UTF-8, licensed under GNU GPL V2+[2].

To search in multiple PDF files, you can use Acrobat Reader X. It has Advanced Search function which can search in multiple pdf files at once; the keyboard shortcut is Control + Shift + F.

If you like the command line, you can install pdftotext from GNUWin32 and use it in conjunction with findstr, which allows regular expression search:

  • for %f in (*.pdf) do @pdftotext "%f" - | findstr /i keyword
  • for %f in (*.pdf) do @pdftotext "%f" - | findstr /i keyword >nul && echo %f
    • Outputs only file names.

However, not all pdfs are converted well by pdftotext, which leads to incomplete search results. For peculiarities of findstr, see Windows Batch Scripting. Instead of findstr, you can use grep if installed.

Microsoft Office documents

edit

By installing Office filter packs, you can enable searching MS Office documents via the built-in indexed Windows search in Windows Vista and later.

Filter packs:

edit
edit