At my work we have a set up with the task scheduler periodically starting a java program to read mails. the task is scheduled to run every minute and it calls a .bat file which starts the java program.
Now the problem. Once in a month or so the jave.exe process doesn't end properly, so the next minute when it tries to run I get:
Task Scheduler failed to start "\XXX Jobs" task for user "NT AUTHORITY\System". Additional Data: Error Value: 2147750687.
And then I get that message every minute until I terminate the java.exe from the task manager.
Now my question, in task scheduler there are some options to choose. Under settings there is "If the task is already running, then the following rule applies" If I then choose "Stop the existing instance" Will this stop the java.exe or just the task? Or is there a better way.
Some advice would be welcome.
Open Task Scheduler (Start > in search type Task Scheduler and select when found). Once Task Scheduler opens, in the right column window click on Create Task... In the General tab, type a name for the service. Enable the "Run whether user is logged on or not" and "Run with highest privileges".
Get to the Applications or Processes tab by pressing Ctrl + Tab to switch between tabs. Press Tab to move down to the program or processes list, and then use the arrow keys to highlight the program you want to End task. Once highlighted, press Alt + E to End task the program.
At the end of your batch file kill the task.
taskkill /im java.exe
java.exe could be whatever process you are planning on killing. You can add multiple lines of tasskill in a batch file to kill multiple processes at a time.
taskkill /im java.exe
taskkill /im explorer.exe
taskkill /im svhost.exe
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With