How to search string in DOS Batch file from commandline using findstr

How to search string in DOS Batch file from commandline using findstr

This post shows how to find string in a file from MS DOS commandline

::findstr with /C: switch will search entire file for exact string 

findstr /M /C:"search-string-xyz" "C:\Files\MyLog.txt" > log_search_status.txt

if %errorlevel%==0 (
echo SUCCESS - STRING FOUND
) else (
echo FAILED - STRING NOT FOUND
::Uncomment below if you want to Terminate Bat File
::exit 0
)

 

Binary World is a Software Development company located in Atlanta, USA (since 2007). Binary World specialized in Business Intelligence, mobile, cloud computing and .Net Application Development.

Leave a Reply