Windows Commands / IT Support Guides
Search a Windows text log with findstr
Use findstr to locate a specific error phrase and its line number in a Windows text log.
Environment and inputs: Windows 11 · Command Prompt unless PowerShell is specified
Understand the problem
Choose the application log for the reported incident. Replace the sample path and keep quotes around a path that contains spaces.
Run the command
Run the displayed command. The /n switch adds line numbers, /i ignores letter case, and /c keeps connection failed together as one search phrase.
findstr /n /i /c:"connection failed" "C:\Support\app.log"
Read the output
An output beginning with 42: means the match is on line 42. Open the log at that line and read the messages immediately before and after it.
Choose the next step
If no lines appear, verify the path and time range. Try a shorter phrase or use a viewer that supports the log’s encoding.
Before making changes
Before sending an excerpt, review it for credentials and personal information. Include the timestamp and the relevant nearby lines.