Monday 15 April 2019

Prevent Windows 7 from sleep + power button hook

I'm used to not shutdown Windows but to sleeping it. I set up power button (PB) action to do it. When I want to shutdown I must go to start -> Shutdown. That's OK.


Now I think of a mechanism that will be hooked up to a PB. Should be started after I press PB but before OS will go to sleep. Something that will check few conditions (i.e. running backup, running AV scan, ...) and if true (something is running) prevent go to sleep.


Optionally: It would be nice to start the same "mechanism" before restart and shutdown (invoked not only from Start menu, but also by other software (i.e. installers) but with option to allow some sources (i.e. UPS software)


Generally: How to run something after PowerButton but before Sleeping. How to code (C#.NET, vbs, batch (preferred)) sleep prevention (cancellation).

No comments:

Post a Comment

How can I VLOOKUP in multiple Excel documents?

I am trying to VLOOKUP reference data with around 400 seperate Excel files. Is it possible to do this in a quick way rather than doing it m...