189

I have to change some connection strings in an incredibly old legacy application, and the programmers who made it thought it would be a great idea to plaster the entire app with connection strings all over the place.

Visual Studio's "current project" search is incredible slow, and I don't trust Windows Search.

So, what's the best free, non-indexed text search tool out there? All it should do is return a list with files that contain the wanted string inside a folder and its subfolders.

I'm running Windows 2003 Server.

7
  • 010 Editor searchs huuuge files in 0 second.
    – Morteza
    Sep 1, 2015 at 14:39
  • Depeche View beats everything else on this page, hands down. There are a few shortcuts you'll want to take a couple mins to read the help file and learn though. stahlworks.com/dev/depeche-view.html
    – BVernon
    May 26, 2016 at 17:48
  • I use this a lot too, however it forces you to click on each result file to see the content matches on the right pane. Also the file content on the right pane is not zoomable (font size is too small).
    – Meryan
    Mar 22, 2017 at 7:27
  • 1
    Have a look at File Content Finder on the app store (disclaimer - I'm the developer). It can search in text/source files, but also in pdf, doc(x), xls(x), and even scanned jpg/png files - microsoft.com/en-au/p/file-content-finder/9mzc4sk6j6bp Apr 15, 2019 at 12:29
  • 1
    If you happen to have IntelliJ IDEA (or any other Jetbrains IDE) open, you can use "Find in Path" (Ctrl + Shift + F). Select "Directory" and enter your desired path. Apr 30, 2019 at 10:33

6 Answers 6

386

I'm a fan of the Find-In-Files dialog in Notepad++. Bonus: It's free.

enter image description here

12
  • Which unfortunately can't -- or doesn't-- search all Microsoft Word files. Something about the difference between ".doc" and ".docm" I suspect Jan 17, 2014 at 17:44
  • 12
    @CarlWitthoft .docm, like .docx, .xlsm, and .xlsx are actually zipped XML documents.
    – Ian Boyd
    Feb 3, 2015 at 21:58
  • 1
    it works well for small folders with a normal number of files, hangs for large sized with many files folders, at least when I use my laptop. A bit faster when using powerful PC. Moreover, while it's searching, cannot open any other files. Feb 12, 2015 at 14:09
  • Found my text. However, did not allow me to select in the results which values to replace and which to keep. All or nothing? Mar 13, 2015 at 20:22
  • 5
    Had no idea this was even an option in notepad++. Great solution to find missing files! It does, however, seem to have issues with large file sizes. Occasionally it gives the "file too large to open" error. Nov 18, 2016 at 12:54
196

There is also a Windows built-in program called findstr.exe with which you can search within files.

>findstr /s "provider=sqloledb" *.cs
8
  • 3
    Simple and efficient! Sep 2, 2015 at 16:46
  • This is much faster than Windows Explorer and actually found the text I was searching for, whereas using Windows Explorer didn't yield search results for me. Thanks.
    – mbomb007
    Nov 12, 2015 at 14:44
  • 1
    For me, the best answer on this topic because you do not need to install anything. In my case I had to complement adding some arguments because is too much information to appear on the screen. The argument /M lists just the file name that has the information that I was looking for. To access the manual of findstr command, type "findstr /?" in the console. Oct 13, 2017 at 11:41
  • This is a great util, but it seems it can't read Cyrillic characters in file names. For example: FINDSTR: Cannot open ???????????.txt Feb 16, 2019 at 19:36
  • 1
    findstr doesn't support UTF16 text. Mar 14, 2019 at 18:33
69

Original Answer

Windows Grep does this really well.

Edit: Windows Grep is no longer being maintained or made available by the developer. An alternate download link is here: Windows Grep - alternate

Current Answer

Visual Studio Code has excellent search and replace capabilities across files. It is extremely fast, supports regex and live preview before replacement.

enter image description here

16
  • 12
    ss64.com/nt/findstr.html Dec 10, 2012 at 11:23
  • 11
    On my machine (Windows 7), it crashed twice. I'll try something else. Oct 22, 2013 at 19:09
  • 2
    It is old, it crashed for me too. Even if not perfect for some goals grepWin is better imoh
    – Paolo
    Oct 28, 2013 at 10:07
  • 9
    AstroGrep is also fast and it is no-istall
    – Zorb
    Oct 30, 2013 at 8:49
  • Worked fine for me on Windows 7 - no crashes
    – w5m
    Dec 10, 2014 at 16:29
38

I like AstroGrep. The results are shown in a list. A click on a row shows you the whole line as a preview highlighting the hit. It seems to be quite fast, lean and it is free. Tested on Windows 7, 8, 10 and Windows Server 2008 R2. Allows regular expressions.

Latest AstroGrep Screenshot

AstroGrep is a Microsoft Windows GUI File Searching (grep) utility. Its features include regular expressions, versatile printing options, stores most recent used paths and has a "context" feature which is very nice for looking at source code

Reference: AstroGrep

3
  • 7
    Off all the other ones listed here, this is the only that lets specify exclusion patterns for folders. Mighty helpful when trying to skip folders like node_modules or bower_components.
    – Mrchief
    Nov 2, 2016 at 15:05
  • 1
    Very good software, fast, configurable, and show files along with related context
    – HanniBaL90
    Nov 17, 2017 at 13:22
  • 1
    And 'fast' deserves a second mention... self == happy
    – cssyphus
    Dec 5, 2018 at 22:36
9

Visual Studio's search in folders is by far the fastest I've found.

I believe it intelligently searches only text (non-binary) files, and subsequent searches in the same folder are extremely fast, unlike with the other tools (likely the text files fit in the windows disk cache).

VS2010 on a regular hard drive, no SSD, takes 1 minute to search a 20GB folder with 26k files, source code and binaries mixed up. 15k files are searched - the rest are likely skipped due to being binary files. Subsequent searches in the same folder are on the order of seconds (until stuff gets evicted form the cache).

The next closest I've found for the same folder was grepWin. Around 3 minutes. I excluded files larger than 2000KB (default). The "Include binary files" setting seems to do nothing in terms of speeding up the search, it looks like binary files are still touched (bug?), but they don't show up in the search results. Subsequent searches all take the same 3 minutes - can't take advantage of hard drive cache. If I restrict to files smaller than 200k, the initial search is 2.5min and subsequent searches are on the order of seconds, about as fast as VS - in the cache.

Agent Ransack and FileSeek are both very slow on that folder, around 20min, due to searching through everything, including giant multi-gigabyte binary files. They search at about 10-20MB per second according to Resource Monitor.

UPDATE: Agent Ransack can be set to search files of certain sizes, and using the <200KB cutoff it's 1:15min for a fresh search and 5s for subsequent searches. Faster than grepWin and as fast as VS overall. It's actually pretty nice if you want to keep several searches in tabs and you don't want to pollute the VS recently searched folders list, and you want to keep the ability to search binaries, which VS doesn't seem to wanna do. Agent Ransack also creates an explorer context menu entry, so it's easy to launch from a folder. Same as grepWin but nicer UI and faster.

My new search setup is Agent Ransack for contents and Everything for file names (awesome tool, instant results!).

3

If you don't want to install Non-Microsoft tools, please download STRINGS.EXE from Microsoft Sysinternals and make a procedure like this one:

@echo off
if '%1' == '' goto NOPARAM
if '%2' == '' goto NOPARAM
if not exist %1 goto NOFOLDER

echo ------------------------------------------
echo - %1 : folder
echo - %2 : string to be searched in the folder
echo - PLEASE WAIT FOR THE RESULTS ...
strings -s %1\* | findstr /i %2 > grep.txt
notepad.exe grep.txt

goto END

:NOPARAM rem - input command not correct
echo ====================================
echo Usage of GREP.CMD:
echo   Grep "SearchFolder" SearchString
echo Please specify all parameters
echo ====================================
goto END

:NOFOLDER
echo Folder %1 does not exist
goto END

:END rem - exit

Not the answer you're looking for? Browse other questions tagged or ask your own question.