如何使 Windows 调度程序启动和停止 python 任务 [英] How to make a windows scheduler Start and Stop a python task

查看:81
本文介绍了如何使 Windows 调度程序启动和停止 python 任务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个通常手动启动的 python 脚本.然后它会运行几天收集信息,直到它断开连接.

I have a python script that I typically kick off manually. It then runs for several days collecting information until it gets disconnected.

我想要做的是让 Windows 调度程序在上午 12:01 开始作业,然后在当天晚上 11:58 终止作业.

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.

通常我可以在 linux 世界中使用 CRON 来做到这一点,但我不确定如何在 Windows 调度程序中做到这一点.

Typically I would be able to do this using CRON in the linux world but am unsure how to do this in Windows Scheduler.

感谢您的帮助!

推荐答案

  1. 在 Windows 中打开任务计划程序.控制面板 -> 管理工具 -> 任务计划程序
  2. 点击创建基本任务"(启动脚本)
  3. 设置触发时间
  4. 设置程序/脚本 = [python.exe 的完整路径]
  5. Add Arguments = [您计划的 Python 脚本的完整路径]
  6. 点击创建基本任务"(结束脚本)
  7. 设置触发时间
  8. Program/Script = taskkill/f/im [python.exe 的完整路径]

本指南进入更多细节.

这篇关于如何使 Windows 调度程序启动和停止 python 任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆