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/