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 )
Leave a Reply
You must be logged in to post a comment.