Solved If...Else... Statement. Not quite sure if it will work.

June 22, 2012 at 11:45:37
Specs: Windows XP
Will this work?
part of my code:
...
FINDSTR /m "RC (return code) = 0" "C:\%fileloc%\DDL_Exec_Logs\%filenm%_OFF_Log.txt"
IF %errorlevel% neq 0 (
ECHO Deployment was not successfull. Errors were found!
ECHO Emailing the admin...
start fail_mail_OFF.vbs
GOTO prod
)

ECHO Emailing the admin...
start success_mail_OFF.vbs
GOTO prod

....

thanks


See More: If...Else... Statement. Not quite sure if it will work.

Report •


#1
June 22, 2012 at 18:38:35
✔ Best Answer
yes. the following alternatives also would work:
FINDSTR /c /m "RC (return code) = 0" "C:\%fileloc%\DDL_Exec_Logs\%filenm%_OFF_Log.txt"
IF %errorlevel% neq 0 (
ECHO Deployment was not successfull. Errors were found!
ECHO Emailing the admin...
start fail_mail_OFF.vbs
) else (
ECHO Emailing the admin...
start success_mail_OFF.vbs
)

and:
FINDSTR /c /m "RC (return code) = 0" "C:\%fileloc%\DDL_Exec_Logs\%filenm%_OFF_Log.txt" && (
ECHO Deployment was not successfull. Errors were found!
ECHO Emailing the admin...
start fail_mail_OFF.vbs
) || (
ECHO Emailing the admin...
start success_mail_OFF.vbs
)

ps: add the /C option, or you'll get false positives on partial matches (see: findstr /?)


Report •

#2
June 25, 2012 at 06:40:20
Thanks, nbrane

Report •

Related Solutions


Ask Question