1.

Solve : who knows to create a script to stop my tool.exe process when i get a type of er?

Answer»

who knows to create a script.bat  to stop my tool.exe process when i get a type of error 12 times in a row?
thank youCurious how your thinking of implementing this with batch. What will be used as a flag that an error happened 12 times. Do you have a log file that is created to where a batch can monitor this log file for 12 instances of an error and then perform a taskkill to tool.exe when 12 instances of some error MESSAGE is found?

Errorlevels might be able to be used if the error reports to command shell and upon error the program doesnt just hang at the error but times out and/or moves on so that you can get the 12 instances of an error maybe. http://www.robvanderwoude.com/errorlevel.php

More here on detecting problems with errorlevels http://stackoverflow.com/questions/13150676/using-errorlevel-in-a-batch-file-to-know-if-a-program-exited-normallyYou aren't learning anything having all these .bat files written for you...Just sayin... Quote from: patio on May 20, 2017, 08:22:03 AM

You aren't learning anything having all these .bat files written for you...Just sayin...

Interesting to view his posting history. Just sayin...
Hi 
If you know what is the exit code from your tool.exe, you can of course deal it with a batch file
Quote from: DaveLembke on May 20, 2017, 08:18:42 AM
Curious how your thinking of implementing this with batch. What will be used as a flag that an error happened 12 times. Do you have a log file that is created to where a batch can monitor this log file for 12 instances of an error and then perform a taskkill to tool.exe when 12 instances of some error message is found?

Errorlevels might be able to be used if the error reports to command shell and upon error the program doesnt just hang at the error but times out and/or moves on so that you can get the 12 instances of an error maybe. http://www.robvanderwoude.com/errorlevel.php

More here on detecting problems with errorlevels http://stackoverflow.com/questions/13150676/using-errorlevel-in-a-batch-file-to-know-if-a-program-exited-normally

i use AlwaysUP to schedule and run my tool.exe As system service,please take a look here ,u think is possible?
https://www.coretechnologies.com/products/AlwaysUp/Plugins/#CheckLogFileForError

this is the error code:
Dropping connection limit due to connection error to:
Dropping connection limit due to connection error to:
Dropping connection limit due to connection error to:
Dropping connection limit due to connection error to:
Dropping connection limit due to connection error to:
Dropping connection limit due to connection error to:
Dropping connection limit due to connection error to:
Dropping connection limit due to connection error to:
Dropping connection limit due to connection error to:
Dropping connection limit due to connection error to:

Now stop MyTool.exe when finds more then 10 errors in a row
Hi 
You can give a try for this script : Code: [Select]echo off
Mode con cols=80 lines=5 & color 9E
set "MyProcess=MyTool.exe"
Title Monitoring the process "%MyProcess%" for error by Hackoo 2017
Set "StopProcess=StopProcess.log"
Set "MyLogFile=Log.log"
Set "ErrorMsg=Dropping connection limit due to connection error to"
:MainLoop
cls
Set /a "ErrorLimit=10"
Set /a "Count=0"
For /f %%A in ('Type "%MyLogFile%" ^| find /I "%ErrorMsg%"') Do (
Set /a Count+=1
)
SET Count=00%Count%
SET Count=%Count:~-2%
echo(
echo                 Monitoring the process "%MyProcess%" for error
echo              The Counting of error message until now is = "%Count%"
echo        The ErrorLimit is set by the script = "%ErrorLimit%" for stopping this process
If "%Count%" GEQ "%ErrorLimit%" (
Goto KILLPROCESS
) else (
echo The counting of error = %Count% > "%StopProcess%"
Timeout /T 60 /Nobreak >nul
)
Goto MainLoop
::****************************************************************
:KILLPROCESS
echo The counting of error is reached to %Count% > "%StopProcess%"
Taskkill /IM "%MyProcess%" /F >> "%StopProcess%" 2>&1
Timeout /T 60 /Nobreak >nul & Goto MainLoop
Exit /b
::****************************************************************
A brief note about programming languages.

If the OP has a hard time with batch files, he might consider looking into an approach that makes things easier. There are a number of tools that have been created to make it easy to perform some kinds of update and maintain things  res on a PC.
Here are just a few better programming tools to save time and reduce unwanted errors. They all begin with the Letter P.

P#
Pearl
PHP
Pizza
PL/M
PostScript
Powershell
Prolog
Python

All the above have features that could make programming easier if you get STUCK with a batch file problem. Some experts  say you can not mix one language with another. I disagree, that is what I used to do years ago and I believe that kind of approach is still a good idea. Some experts  do not like it because it is not "Pure". Well, there is a language called "Pure" and it is tolerant.

[Pure is a small language designed from scratch; its INTERPRETER is not large, and the library modules are written in Pure.]

But even "Pure" will let you invoke other stuff if need be.

The pint I wish to make is the OP might consider looking around and trying to add to his skills. 

I will stop here. Just saying that the OP ought to do wider  study of programming. Looking at another language might help. 
Quote from: Geek-9pm on May 20, 2017, 10:18:31 PM
A brief note about programming languages.

If the OP has a hard time with batch files, he might consider looking into an approach that makes things easier. There are a number of tools that have been created to make it easy to perform some kinds of update and maintain things  res on a PC.
Here are just a few better programming tools to save time and reduce unwanted errors. They all begin with the Letter P.

P#
Pearl
PHP
Pizza
PL/M
PostScript
Powershell
Prolog
Python

All the above have features that could make programming easier if you get stuck with a batch file problem. Some experts  say you can not mix one language with another. I disagree, that is what I used to do years ago and I believe that kind of approach is still a good idea. Some experts  do not like it because it is not "Pure". Well, there is a language called "Pure" and it is tolerant.

[Pure is a small language designed from scratch; its interpreter is not large, and the library modules are written in Pure.]

But even "Pure" will let you invoke other stuff if need be.

The pint I wish to make is the OP might consider looking around and trying to add to his skills. 

I will stop here. Just saying that the OP ought to do wider  study of programming. Looking at another language might help. 

I use AlwaysUP to run my tool.exe and ... alwaysup have this option too can u help me config. please?
https://www.coretechnologies.com/products/AlwaysUp/Plugins/#CheckLogFileForError Quote from: Hackoo on May 20, 2017, 09:05:42 PM
Hi 
You can give a try for this script : Code: [Select]echo off
Mode con cols=80 lines=5 & color 9E
set "MyProcess=MyTool.exe"
Title Monitoring the process "%MyProcess%" for error by Hackoo 2017
Set "StopProcess=StopProcess.log"
Set "MyLogFile=Log.log"
Set "ErrorMsg=Dropping connection limit due to connection error to"
:MainLoop
cls
Set /a "ErrorLimit=10"
Set /a "Count=0"
For /f %%A in ('Type "%MyLogFile%" ^| find /I "%ErrorMsg%"') Do (
Set /a Count+=1
)
SET Count=00%Count%
SET Count=%Count:~-2%
echo(
echo                 Monitoring the process "%MyProcess%" for error
echo              The Counting of error message until now is = "%Count%"
echo        The ErrorLimit is set by the script = "%ErrorLimit%" for stopping this process
If "%Count%" GEQ "%ErrorLimit%" (
Goto KILLPROCESS
) else (
echo The counting of error = %Count% > "%StopProcess%"
Timeout /T 60 /Nobreak >nul
)
Goto MainLoop
::****************************************************************
:KILLPROCESS
echo The counting of error is reached to %Count% > "%StopProcess%"
Taskkill /IM "%MyProcess%" /F >> "%StopProcess%" 2>&1
Timeout /T 60 /Nobreak >nul & Goto MainLoop
Exit /b
::****************************************************************

ok thank you, i will try your script
Hackoo i use AlwaysUP scheduler to run my Tool.exe  As System and we have this option can u try to configure it please?take a look here
https://www.coretechnologies.com/products/AlwaysUp/Plugins/#CheckLogFileForErrorThere's no need to Quote all the replies to your posts...

Thank You.can u stop also cmd.exe and my tool.exe too?karlosss,
CMD.EXE is a part of Windows and is used to start batch files.
tool.exe is not identified as a standard item in Windows.
Some say that is the name used by malware.
Please explain where you got the tool.exe program, because we just can not guess what it is supported to do.

Here is just one of many links about tool.exe.
https://www.tenforums.com/software-apps/45148-software-reporter-tool-exe.html
So such a generic name makes for confusion.  i have a Script.bat who runs my tool.exe Quote from: karlosss on May 21, 2017, 12:03:58 PM
i have a Script.bat who runs my tool.exe
What is tool.exe?
If it is from a credulous PUBLISHER, it would have documentation that would help.


Discussion

No Comment Found