Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: who knows to create a script to stop my tool.exe process when i get a type of er  (Read 7405 times)

0 Members and 1 Guest are viewing this topic.

karlosss

    Topic Starter


    Beginner

    • Experience: Beginner
    • OS: Windows XP
    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 you

    DaveLembke



      Sage
    • Thanked: 662
    • Certifications: List
    • Computer: Specs
    • Experience: Expert
    • OS: Windows 10
    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

    patio

    • Moderator


    • Genius
    • Maud' Dib
    • Thanked: 1769
      • Yes
    • Experience: Beginner
    • OS: Windows 7
    You aren't learning anything having all these .bat files written for you...Just sayin...
    " Anyone who goes to a psychiatrist should have his head examined. "

    Salmon Trout

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

    Interesting to view his posting history. Just sayin...

    Hackoo



      Hopeful
    • Thanked: 42
    • Experience: Expert
    • OS: Windows 10
    Hi  ;)
    If you know what is the exit code from your tool.exe, you can of course deal it with a batch file ;)

    karlosss

      Topic Starter


      Beginner

      • Experience: Beginner
      • OS: Windows XP
      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
      « Last Edit: May 20, 2017, 11:37:18 AM by karlosss »

      Hackoo



        Hopeful
      • Thanked: 42
      • Experience: Expert
      • OS: Windows 10
      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
      ::****************************************************************

      Geek-9pm


        Mastermind
      • Geek After Dark
      • Thanked: 1026
        • Gekk9pm bnlog
      • Certifications: List
      • Computer: Specs
      • Experience: Expert
      • OS: Windows 10
      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.  8)

      karlosss

        Topic Starter


        Beginner

        • Experience: Beginner
        • OS: Windows XP
        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.  8)

        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

        karlosss

          Topic Starter


          Beginner

          • Experience: Beginner
          • OS: Windows XP
          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/#CheckLogFileForError
          « Last Edit: May 21, 2017, 12:36:42 AM by karlosss »

          patio

          • Moderator


          • Genius
          • Maud' Dib
          • Thanked: 1769
            • Yes
          • Experience: Beginner
          • OS: Windows 7
          There's no need to Quote all the replies to your posts...

          Thank You.
          " Anyone who goes to a psychiatrist should have his head examined. "

          karlosss

            Topic Starter


            Beginner

            • Experience: Beginner
            • OS: Windows XP
            can u stop also cmd.exe and my tool.exe too?

            Geek-9pm


              Mastermind
            • Geek After Dark
            • Thanked: 1026
              • Gekk9pm bnlog
            • Certifications: List
            • Computer: Specs
            • Experience: Expert
            • OS: Windows 10
            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.  :-\
            « Last Edit: May 21, 2017, 11:01:07 AM by Geek-9pm »

            karlosss

              Topic Starter


              Beginner

              • Experience: Beginner
              • OS: Windows XP
              i have a Script.bat who runs my tool.exe

              Geek-9pm


                Mastermind
              • Geek After Dark
              • Thanked: 1026
                • Gekk9pm bnlog
              • Certifications: List
              • Computer: Specs
              • Experience: Expert
              • OS: Windows 10
              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.

              DaveLembke



                Sage
              • Thanked: 662
              • Certifications: List
              • Computer: Specs
              • Experience: Expert
              • OS: Windows 10
              Geek-9pm caught my attention with this, and user name rang a bell with RDP stuff from past which was odd, so I decided to go looking at history:

              Quote
              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.

              Looking at past post history here with ncrack and RDP tricks. Hopefully this isnt a tool we are assisting in the creation of "bending" a Tool.exe program around batch or other code using it with questionable intent. Below is link of Karlosss history.

              https://www.computerhope.com/forum/index.php?action=profile;u=158444;area=showposts;start=30

              patio

              • Moderator


              • Genius
              • Maud' Dib
              • Thanked: 1769
                • Yes
              • Experience: Beginner
              • OS: Windows 7
              As he is already a resident of our Moderator watch list we'll see what kind of response is forthcoming...
              " Anyone who goes to a psychiatrist should have his head examined. "

              karlosss

                Topic Starter


                Beginner

                • Experience: Beginner
                • OS: Windows XP
                no no this type is not about rdp

                Geek-9pm


                  Mastermind
                • Geek After Dark
                • Thanked: 1026
                  • Gekk9pm bnlog
                • Certifications: List
                • Computer: Specs
                • Experience: Expert
                • OS: Windows 10
                As he is already a resident of our Moderator watch list we'll see what kind of response is forthcoming...
                I read the first post that was given by DaveLembke.

                Yes, his request does seem to be in the suspicions category.
                In that other post he has a computer in the same room and wants to turn it on by remote control.  ::)

                karlosss

                  Topic Starter


                  Beginner

                  • Experience: Beginner
                  • OS: Windows XP
                  ok if u think that please close the thread and everything will be ok
                  thanks for everything guys

                  patio

                  • Moderator


                  • Genius
                  • Maud' Dib
                  • Thanked: 1769
                    • Yes
                  • Experience: Beginner
                  • OS: Windows 7
                  Topic Closed.

                  patio.
                  " Anyone who goes to a psychiatrist should have his head examined. "