I want to write a batch script statement where: FINDSTR has to check for a string AND IF found then just print out FAILED and end the program IF NOT FOUND then go check/look for another string AND IF FOUND then print out SUCCEEDED and close the program, IF NOT FOUND then print out the error message again. Any ideas?
Here is what I did:
ECHO Checking the log file for errors...
FINDSTR /C:"Open failed" some_Log.txt && (ECHO Deployment FAILED.
cscript //nologo success_mail.vbs
pause) || FINDSTR "RC (return code) = 0" && (ECHO Deployment was successful.
cscript //nologo fail_mail.vbs
pause)
I don't know why it is not working. Any help would be appreciated.
Here is what i my latest one looks like:
ECHO Checking the log file for errors...
FINDSTR /C:"Open failed" some_Log.txt some_Log.txt && (
ECHO Deployment FAILED.
cscript //nologo fail_mail.vbs
GOTO offshore ) || (
FINDSTR /C:"RC (return code) = 0" some_Log.txt && (
ECHO Deployment was successful.
cscript //nologo success_mail.vbs
GOTO offshore)
)
And, it is not working. Do you see any errors? Thanks in advance.