ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Coding Snacks

I need a batch command to stop the process and exit immediately when it finds th

(1/1)

johnny09033:
I need a batch command to stop the process and exit immediately when it finds this error:
connection error

the batch works with a certain tool and these are some benchmarks if they help something
The script I own closes the process in these situations and I want someone to help me add a new situation


:: Controll stopping
:: (1=enable,0=disable;)


--- ---:: Error exit codes
SET /A ERROR_UNKNOWN=-1
SET /A ERROR_OK=0
SET /A ERROR_NO_BOOKMARK_FOUND=1
SET /A ERROR_NO_MORE_DICTS=2
SET /A ERROR_FINDSTR_UNKNOWN_EXIT_CODE=3
and

1'st exit situation:

--- ---:: Check if the file exists
IF NOT EXIST "%filep%" (
ECHO File "%filep%" was not found. Assuming we ran out.
ECHO We did not find.
SET /A errno=%ERROR_NO_MORE_DICTS%
GOTO END
)
Another exit situation:


--- ---) ELSE (
:: tool did not run ok. No ideea why. The multitude of checks should have
:: prevented this.
ECHO %tool% exited with non-zero exit code. No ideea why. Contact dev.
SET /A errno=%ERROR_UNKNOWN%
GOTO END
)

The 3'rd situation:


--- ---:: Call command
%composedcmd%

:: Check if we ran ok
IF /I "%ERRORLEVEL%" EQU "%ERROR_OK%" (
:: Check if we found mamammia
FIND "Discovered mamammia" "%tooloutfile%" >NUL 2>&1 && (
ECHO mamammia.
GOTO END
I want to add new exit,so when finds this error EXIT:

--- ---connection error


THANK YOU!

Contro:
Seems an interesting question.
Perhaps you can do in AHK. There are many experts here in this script language...

Navigation

[0] Message Index

Go to full version