4

Is there a scripting possibility or application, free or commercially avaible, that would allow me to set up windows to close a partuicular application before it goes to sleep mode?

3 Answers 3

4

You can create a Scheduled Task in Windows' Task Scheduler.

There is an "When a specific event is logged" trigger available. The event you need to trigger on is in the "System" log with the Source "USER32" and Event Id 1074. This event is logged whenever the system shuts down or goes into hibernation.

As for the shutting down a particular application you add an action the the Scheduled Task which starts the "taskkill" program. With

/IM "ExecutableName.exe"

as argument it will shut down the ExecutableName.exe. You may need to add a /F switch to make it force the program to shutdown (instead of just asking nicely).

1
3

This is just a addition to Anders J's answer...

On Windows 10 in System log I right clicked on Event Id 42 and added task (bat script basically) with taskkill command from my comment...

Attach Task To This Event...

0
  1. I've found this utility, but I haven't tried it.

  2. You can script it. How to make a computer sleep you can find here. How to kill a specific process you can find here. Just put both in one file with ".bat" as extension.

2
  • 1
    Well, I don't need to trigger sleep automatically. I need to "subscribe" to sleep event and be able to run the command then. Oct 3, 2013 at 15:13
  • 1
    I would have suggested EventTriggers.exe (Win XP\2003, in newer versions there's an option in eventvwr.msc), but I don't know how it acts exactly and if Windows actually waits for the trigger to end before shutting down. The first option I've suggested seems to do (haven't tried myself, as I wrote) what you're asking for, and the second option gives you a manual option to that.
    – EliadTech
    Oct 6, 2013 at 5:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .