I have a python script that I typically kick off manually. It then runs for several days collecting information until it gets disconnected.
What I want to do is have the Windows scheduler start the job 12:01 AM and then terminate the job at 11:58 pm that same day.
Typically I would be able to do this using CRON in the linux world but am unsure how to do this in Windows Scheduler.
Thank you for your help!
- Open Task Scheduler in Windows. Control Panel -> Administrative Tools -> Task Scheduler
- Click 'Create Basic Task' (to start the script)
- Set the trigger time
- Set Program/Script =
[full path to python.exe]
- Add Arguments =
[full path to your scheduled python script]
- Click 'Create Basic Task' (to end the script)
- Set the trigger time
- Program/Script =
taskkill /f /im [full path to python.exe]
This guide goes into more detail.