Find & Search Inside Files

Microsoft File Explorer search functions are limited to a few file types. What other options are available?

MS File Explorer – Expanding it’s Limited Default Capabilities

By default File Explorer will only search for text inside a limited set of file extensions (a.k.a. file types).
The https://dataself.atlassian.net/wiki/spaces/DS/pages/1979252765 feature in Windows Control Panel can be set to add search support of additional file extensions.

The default supported file types include TXT files, DOCX files, LOG files, XLSX files.

See https://dataself.atlassian.net/wiki/spaces/DS/pages/2132279297

DOS findstr Command

In a Windows Command prompt, the findstr command searches the current directory (in this case C:\) and all subdirectories for the pattern “COMMIT” in any file with a .cs extension and outputs only the filename.

C:\>findstr /s /m "COMMIT" *.cs

For more, see: https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/findstr

PowerShell

Search Current Directory

Searchs the current path for .bat files contain the string "Monthly".

Select-String -Path "*.bat" -SimpleMatch -Pattern "Monthly" Select-String -Path "*.bat" "Monthly"
  • -SimpleMatch uses a simple match rather than a regular expression match.
    In a simple match, Select-String searches the input for the text in the Pattern parameter. It doesn't interpret the value of the Pattern parameter as a regular expression statement.

  • Default search type is a regular expression search.

The PowerShell command below searches the current directory (in this case C:\) and all subdirectories for .cs files containing text with the pattern "COMMIT" and lists the filenames.

PS C:\>Get-ChildItem -Path "*.cs" -Recurse | Select-String "COMMIT" -List | Select Path

For more, see:

NotePad++

Notepad++ is a widely used and well recommended, open source text editor. Notepad++ can be installed as a stand-alone .exe file. Notepad++ (notepad-plus-plus.org)

Notepad++ Find in Files

  • Search > Find in Files… (Ctrl + Shift + F)