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?

Oliver Salzburg
  • 89,072
  • 65
  • 269
  • 311
Maxim V. Pavlov
  • 1,653
  • 6
  • 24
  • 38

3 Answers3

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

Anders J
  • 166
  • 7
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...

Betlista
  • 185
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.

EliadTech
  • 2,184