
Many of us rely on Windows Search?to find files and launch programs, but searching for text within files is limited to specific file types by default. Here’s how you can expand your search to include other text-based files.
我們中的許多人都依賴Windows搜索來查找文件和啟動程序,但是默認情況下,在文件中搜索文本僅限于特定的文件類型。 您可以通過以下方式擴大搜索范圍,以包括其他基于文本的文件。
We have shown you some?advanced search operators using Windows Search?before?and even how to change?which files are indexed and how to rebuild your search index. But what about searching for text inside of .html, .php, .js, and other text-based web and scripting files? Windows search allows you to include other file extensions in its index with a few simple clicks.
我們已經向您展示了一些使用Windows Search的高級搜索運算符,甚至還介紹了如何更改被索引的文件以及如何重建搜索索引。 但是,如何在.html,.php,.js以及其他基于文本的Web和腳本文件中搜索文本呢? Windows搜索使您只需單擊幾下即可在索引中包括其他文件擴展名。
This technique works in Windows 10, 8, 7, or even Vista. The screens might look a little different, but it’s the same basic process on all versions.
此技術適用于Windows 10、8、7甚至Vista。 屏幕可能看起來有些不同,但是在所有版本上都是相同的基本過程。
Hit Start, type “index,” and then click the “Indexing Options” result.
單擊開始,鍵入“索引”,然后單擊“索引選項”結果。

In the “Indexing Options” window, click the “Advanced” button.
在“索引選項”窗口中,單擊“高級”按鈕。

In the “Advanced Options” window, switch to the “File Types” tab. Select the extension for the file type you would like to include in content searches, and then select the “Index Properties and File Contents” option under the list.?The text in the “Filter Description” column should change to reflect whatever filter is used to open that file type by default. In our example, we’re selecting the BAT extension, so the filter type changes to “Plain Text Filter.”
在“高級選項”窗口中,切換到“文件類型”選項卡。 選擇要包含在內容搜索中的文件類型的擴展名,然后在列表下方選擇“索引屬性和文件內容”選項。 默認情況下,“過濾器說明”列中的文本應更改以反映用于打開該文件類型的任何過濾器。 在我們的示例中,我們選擇了BAT擴展名,因此過濾器類型更改為“純文本過濾器”。

If you don’t find file type you’re looking for on the list, it means no app is set as the default handler for that file type. To add the file type, type the extension in the “Add New Extension to List” box and then click the “Add” button. By default, Windows Search will use a plain text filter to search the contents of those types of files, since another app is not associated.
如果在列表中找不到要查找的文件類型,則意味著沒有應用設置為該文件類型的默認處理程序。 要添加文件類型,請在“將新擴展名添加到列表”框中鍵入擴展名,然后單擊“添加”按鈕。 默認情況下,Windows Search將使用純文本過濾器來搜索這些類型的文件的內容,因為另一個應用程序未關聯。

After the index is rebuilt, searching for text inside one of the new file types should now show results.
重建索引后,在一種新文件類型中搜索文本現在應該顯示結果。

If you’d like to always search within file contents for a specific folder, navigate to that folder in File Explorer and open the “Folder and Search Options.”
如果您想始終在文件內容中搜索特定文件夾,請在文件資源管理器中導航至該文件夾,然后打開“文件夾和搜索選項”。

On the “Search” tab, select the “Always search file names and contents” option.
在“搜索”選項卡上,選擇“始終搜索文件名和內容”選項。

After the index rebuilds, searches in that folder will automatically include file contents.
重建索引后,在該文件夾中的搜索將自動包括文件內容。
翻譯自: https://www.howtogeek.com/99406/how-to-search-for-text-inside-of-any-file-using-windows-search/