How to make a windows scheduler Start and Stop a python task [closed]

血红的双手。 提交于 2019-12-13 20:27:49

问题


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!


回答1:


  1. Open Task Scheduler in Windows. Control Panel -> Administrative Tools -> Task Scheduler
  2. Click 'Create Basic Task' (to start the script)
  3. Set the trigger time
  4. Set Program/Script = [full path to python.exe]
  5. Add Arguments = [full path to your scheduled python script]
  6. Click 'Create Basic Task' (to end the script)
  7. Set the trigger time
  8. Program/Script = taskkill /f /im [full path to python.exe]

This guide goes into more detail.



来源:https://stackoverflow.com/questions/46529351/how-to-make-a-windows-scheduler-start-and-stop-a-python-task

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!