Multiple File Searching

Dell / Optiplex gx270...
April 18, 2011 at 22:26:55
Specs: Microsoft Windows XP Professional, 2.793 GHz / 1534 MB
I know it is possible to search in a specified file for keywords, but how can I search though a whole folder.

Searching directory for .txt files
Looking for greet messages

Line 1 on Greet.txt: Hello everyone
Line 2 on Greet.txt: Hi everyone
Line 1 on Welcome.txt: Welcome to my Batch File

See More: Multiple File Searching

Report •

April 18, 2011 at 22:56:25
"string" is the search string.

Add "/s" after findstr to include subdirectories:

@echo off
pushd "t:\he\dir"

for /f "tokens=1-3* delims=:" %%a in (' findstr /n string "%cd%\*" ') do (
    echo Line %%c in %%~nxb:%%d

Report •
Related Solutions

Ask Question