How To Guides Org

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

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

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!