Hello all,
I have an application that when it finishes creates some log files.
I need to do a search in one of the log files (text files) for the words "Success" or "Failure".
If I find "Success" then I run a message box informing the users that the application completed successfully and if I find "Failure", the message box informs the users it failed.
I like to do this in a simple dos script as I am running the actual application by a dos script.
Any help is much appreciated.
Thanks...
Search for a string and perform an action
Moderator: DosItHelp
-
- Posts: 36
- Joined: 17 Jul 2008 07:37
Do you mean something like this?
Code: Select all
setlocal
set inputfile=%1
for /f %%a in ('findstr Success %inputfile%') do set foundS=%%a
if [%foundS%]==[] (set success=0) ELSE (set success=1)
for /f %%a in ('findstr Failure %inputfile%') do set foundF=%%a
if [%foundF%]==[] (set failure=0) ELSE (set failure=1)
echo %success%
echo %failure%