I want to run a python script before shutdown of system.I am using Windows 7.I have run python script on startup of system but i am not getting to run script before shutdown.
I Refer How to schedule a task to run when shutting down windows and Many Questions like this on SO but somehow that's not working.Please anyone can tell me ?
Does startup and shutdown only works for .bat file?
Yes, in windows as a startup/shutdown script you need to provide Batch file.
Here is workaround I would suggest for you.
Create .bat script with following code(assuming that you have python included in PATH):
for %%i in (/Shutdown/*.py) do python C:/Shutdown/%%i
Add .bat script to windows shutdown schedule.
Run gpedit.msc
Computer Configuration -> Windows Settings -> Scripts -> Shutdown -> Properties -> Add
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With