Detecting windows shutdown event - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Detecting windows shutdown event (/thread-22423.html) |
Detecting windows shutdown event - riccardoob - Nov-12-2019 Hi, I probably have a tricky question here. I'd like to know if there's a way in python to detect (maybe using an infinite loop in a script run in background) if windows is shutting down, does anyone know how to do this? RE: Detecting windows shutdown event - Larz60+ - Nov-12-2019 other than blue screen of death? Windows has a way of exploding. Microsoft has a blog on this here: https://social.msdn.microsoft.com/Forums/en-US/c53062da-a17a-4bfe-b868-ee2b2b11c935/intercepting-shutdown-command?forum=csharplanguage RE: Detecting windows shutdown event - riccardoob - Nov-12-2019 I read the post you linked, but I don't need to interrupt shutdown process, I essentially want to execute a script when the shutdown button is pressed (not the physical one) and make sure that it execute correctly. RE: Detecting windows shutdown event - Larz60+ - Nov-12-2019 Quote:I'd like to know if there's a way in python to detect (maybe using an infinite loop in a script run in background) if windows is shutting dowThe first reply explains on URL I provided: 'how to intercept the shutdown command.' you don't have to use the code verbatim, just use the 'Detect' part!!! RE: Detecting windows shutdown event - Aurthor_King_of_the_Brittons - Nov-12-2019 It looks like you could create a batch file to run your script on Windows shutdown. Excecute code on Windows shutdown |