1
2
I have tried How to start a program when another one is started and this works perfectly. But how about the other way around? I would like to run a .bat when chrome is closed. By "is closed" I mean... I start chrome and when I close it I want something to happen.
Process termination
stands for event with ID 4689
So I have tried:
<QueryList>
<Query Id="0" Path="Security">
<Select Path="Security">
*[System[Provider[@Name='Microsoft-Windows-Security-Auditing'] and Task = 13312 and (band(Keywords,9007199254740992)) and (EventID=4689)]]
and
*[EventData[Data[@Name='NewProcessName'] and (Data='PATH TO CHROME')]]
</Select>
</Query>
</QueryList>
But it didnt work at all... task did not show any new log when I closed chrome.
Is there something im missing?
By default the part with Task = 13312
using Process Terimation
was Task = 13313
, however I have tried it with both 13312
and 13313
and doesnt seem to work.
UPDATE 1: Chrome was not the best "example" to pick and try this with task scheduler. I also tried different programs that do not have any background processing after beeng closed, like Notepad, Minesweeper etc... neither of those seem to trigger the task.
What do you want the .bat to do? Perhaps we could tackle your goal head-on rather than enabling you to beat around the bush. – adampski – 2016-10-05T11:27:27.870
@adampski to get it straight, I want DB (MariaDB) with Apache to shutdown once I close my IDE (netbeans) the bat just contains this:"sc stop Apache sc stop MyDB". – Alpha2k – 2016-10-05T11:41:52.660
Could be chrome is running background processes, which can be found in the menu -> settings -> advanced settings -> sytem -> "continue running background apps when google chrome is closed". Just a heads up in case this could potentially keep chrome running after you close it. – Mr. Hargrove – 2016-10-05T11:45:17.013
How does Chrome have anything to do with this then? Or is it just an example process you're using? – adampski – 2016-10-05T11:56:02.463
@adampski it's just an example, have tried notepad and some other program that don't have any background processing but they neither work, maybe chrome isn't the best example... – Alpha2k – 2016-10-05T12:00:55.413
I agree it's not a good example, you just ask questions as closely as possible to your scenario because I was about to suggest a a Chrome extension. I'll have a look around I think this could be achieved with custom bat with process checking in it with NSSM – adampski – 2016-10-05T12:04:29.800