Productivity Tip: How to find string or word in text file via command prompt

Locating String In Text File_ll Locating strings is easy using notepad++, but sometimes it’s more practicable to use the command prompt to locate strings, here’s how to do that

1. Step Open the command prompt (enter cmd.exe into the search bar)

2. Step Enter findstr /c:"String" %path%\to\file\file.txt |more

3. Step Here’s an example:


cd D:\
cd D:\test
findstr /c:"random" file.txt

Locating String In Text File

This method works great to find any string in a file

It’s particularly useful whenever you want to find a string in a file that is acces-protected e.g. you need elevated permissions to access it. Instead of taking ownership of that file you can open an elevated command prompt and then use the command findstr /c to locate a string in the protected file

Handy!

Published: Tuesday, January 29th, 2013 Last Modified: January 29, 2013

Related Posts

Rate This Article
5 of 5 0 (100%) 1 vote