How to Search the Contents of Any File Type Using Windows Search

Windows Search and its Advanced Query Syntax (AQS) is a freaking awesome feature in Windows. It lets you quickly find a particular file or group of files with a specific name or metadata, in a folder and sub-folders.

Along with indexing file properties or metadata, most known plain-text files are also content indexed by default. When a file type is content indexed, Windows Search lists out the files that contain the word or phrase in the file contents when you type a search phrase in the Search box.

Which Plain-Text Files are “Content Indexed” by Default?

By default, known plain-text file types such as .BAT, .CMD, .CPP, .VBS. Here is the full list of file types that are, by default, content indexed on a Windows 10 computer:

A, ANS, ASC, ASM, ASX, AU3, BAS, BAT, BCP, C, CC, CLS, CMD, CPP, CS, CSA, CSV, CXX, DBS, DEF, DIC, DOS, DSP, DSW, EXT, FAQ, FKY, H, HPP, HXX, I, IBQ, ICS, IDL, IDQ, INC, INF, INI, INL, INX, JAV, JAVA, JS, KCI, LGN, LST, M3U, MAK, MK, ODH, ODL, PL, PRC, RC2, RC, RCT, REG, RGS, RUL, S, SCC, SOL, SQL, TAB, TDL, TLH, TLI, TRG, TXT, UDF, UDT, USR, VBS, VIW, VSPSCC, VSSCC, VSSSCC, WRI, WTX

Enable Searching File Contents of Any File Type

If you have a custom file type that is of plain-text format, and want to fully index (except the stop words) the contents, you can add the file extension manually in indexing options. Type Indexing Options in the Start/Cortana search box and click on the search result.

indexing options start menu search

To add custom or unknown plain-text files like, .AHK or .PHP, in the Indexing Options dialog, click Advanced, and click File Types.

php custom file extension index contents

Type the file extension PHP, select Index Properties and File Contents radio-button, and click OK. After you press OK, the prompt “Rebuilding the index might take a long time to complete. Some views and search results might be incomplete until rebuilding is finished.” appears.

rebuild index prompt

Click OK, and give the indexer considerable time (may be even hours) to do its job.

Enable Searching File Contents of PowerShell Scripts (.PS1) (Example)

PowerShell script file type .PS1, although it’s a known plain-text file, is not content indexed by default. To demonstrate this, I have two files with different file extensions, but containing exactly same PowerShell code.

windows search content index demo

As you can see, the file contains a word named Defender.

ps1 file contents code

However, when I typed defender in the Search text box, it listed only the text (.txt) file, although the .PS1 file has got the same contents.

.ps1 not content indexed

To search file contents of .PS1 using Windows Search, enable content indexing for the file extension. In Indexing Options, click Advanced, and select the File Types tab. Select .PS1 from the list and enable Index Properties and File Contents radio-button.

ps1 index file properties and contents

Click OK, and give ample time for Windows Search to index the chosen file type. Rebuilding may take anywhere from minutes to hours depending upon the system configuration, number of files and user activity level in the system.

Don’t expect Windows to content index your additional file types immediately. It can take hours.

After an hour or so, Windows Search indexed the contents of all .PS1 files duly, and here is the search results:

.ps1 after content indexed

Exclude Files in Specific Folders to Prevent the Contents Indexed

Content indexing additional file types mean additional database file size and additional resources consumed by the Search Indexer. To keep the database size down, enable the option only for the files you need. For rest of the file types, you can choose to index only the file properties and metadata.

Besides configuring content indexing on a per-file type basis, you can exclude certain folders (or files) as well. Right-click on a file or folder, click Properties and click Advanced.

disable contents index for a folder

Note: You can do this on per-file or per-folder basis.

Uncheck Allow files in this folder to have contents indexed in addition to file properties, and click OK. For folders, Windows asks you whether to apply the settings for files from the current folder only, or for sub-folders as well. Choose the appropriate option and click OK.



From now on, Windows Search will not index the contents of the files present in that particular folder, regardless of your per-file type setting in the File Types dialog in Indexing Options. This helps lower the burden of Windows Search, as well as keep the database size smaller.

Additional Windows Search Tips and Tricks

1. Search file names only, not the contents (even with content indexing enabled)

To search only for file name, use the search operator filename: or name: – For example, the advanced search query filename:*audit* lists out files that contain the word audit in the file name, regardless of file contents. For accurate searches, always use advanced search operators.

Refine your searches using Search tab Ribbon commands

Don’t like manually typing or memorizing the advanced query syntax? No problem! use the advanced search ribbon buttons in File Explorer Search tab to refine your searches. It fills up the search operators automatically in the search text box.

AQS search ribbon buttons refine search

For demonstration, I added a 0-byte file named defender.txt along with sample.txt and sample.ps1.

AQS and windows search content search

The files sample.txt & sample.ps1 contain the word defender inside the file. In this case, typing defender in search box lists all three files:

AQS and windows search content search

That’s because for freestyle keyword searches, Windows Search looks for the filename, as well as it searches the contents (of included file types) for the keyword used. If I used the Advanced Query Syntax (AQS) syntax filename: or name: it searches for the file name only, as seen in the following screenshot.

AQS and windows search content search

Similarly, there are many such advanced search operators that you’d like to be familiar with. For example, using the AQS, you can search for Files created between two dates. You can mix and match multiple search operators to refine your searches. With Windows Search’s AQS, the opportunities are endless.

2. Search file contents even in non-indexed locations

Thus far, everything written in this article apply to indexed locations. For non-indexed paths, Windows has to scour through each file or folder in the file system and fetch the results. This will be accurate, but very slow and drains the system resources more. If you wish to search file contents in non-indexed locations, there is a setting you can enable.

Open File Explorer, click the File menu and select “Change folder and search options”. Click the Search tab and enable the option named Always search file names and contents (this might take several minutes), and click OK.

enable search contents in non-indexed locations

It’s worth reiterating that the above setting when enabled, will cause the searches to slow down very much, and the system performance certainly takes a hit with constant churning of the hard drive. Please use the above setting judiciously — enable it only when it’s absolutely necessary.

searchWindows Search feature, other than the occasional search indexer service hiccups (which can be fixed) which you may experience, is a real time-saver when it works, and it’s a productive tool that eases our workflow.

Information in this article applies to Windows Vista and higher, which includes Windows 10 and Windows Server Operating Systems.
Featured image Credit: earvine95, pixabay.com


One small request: If you liked this post, please share this?

One "tiny" share from you would seriously help a lot with the growth of this blog. Some great suggestions:
  • Pin it!
  • Share it to your favorite blog + Facebook, Reddit
  • Tweet it!
So thank you so much for your support, my reader. It won't take more than 10 seconds of your time. The share buttons are right here. :)

About the author

Ramesh Srinivasan founded Winhelponline.com back in 2005. He is passionate about Microsoft technologies and he has been a Microsoft Most Valuable Professional (MVP) for 10 consecutive years from 2003 to 2012.

1 thought on “How to Search the Contents of Any File Type Using Windows Search”

  1. So I want to search the content of thousands of files that this program stores with the name NNNNNNN.nnnn, where “nnnn” is a number between 0001 and 9999.
    How about that?

    I lifted the files (via .zip) to Linux and searched there – but that’s very cumbersome.

Leave a Comment