Home > Back-end >  Windows execute command before sleep / on power button press
Windows execute command before sleep / on power button press

Time:12-31

I want my power button to send a HTTP request before going to sleep.

I already set a task to execute with trigger System/Kernel-Power/42 but the task executes after the next wake rather than before sleep.

Also autohotkey doesn't seem to log the power button neither does a windows trigger.

Is it possible to delay windows sleep? I could not find a way to do that.

Thanks

CodePudding user response:

So it's not a real answer but I came up with a solution:

If the wifi hotspot is turned on (I need it anyways) while my pc goes into sleep mode, it sends a System/Kernel-Power/59 and turns the monitor off.

I now have a task that listens for this and executes what I want, then turns the hotspot off and then turns the pc into sleep mode.

  • Related