python 任务计划_使用Python添加计划任务

该博客介绍如何利用Python的COM接口与Windows任务计划程序交互,创建一个定时任务,该任务将在指定时间启动Notepad。代码示例中详细展示了设置任务描述、注册信息、主体、设置、触发器和执行动作的过程。
摘要由CSDN通过智能技术生成

def schtask_com():

'''

Written by Honglei Jiang. Modified from corresponding VB version.

参考资料:

* Advanced Python and COM

http://oreilly.com/catalog/pythonwin32/chapter/ch12.html

* Using the Task Scheduler

http://msdn.microsoft.com/en-us/library/windows/desktop/aa384006(v=VS.85).aspx

http://msdn.microsoft.com/en-us/library/windows/desktop/aa383507(v=VS.85).aspx

* Starting an Executable at a Specific Time

http://msdn.microsoft.com/en-us/library/windows/desktop/aa382152(v=VS.85).aspx

'''

import win32com.client, sys

#A constant that specifies a time-based trigger.

TriggerTypeTime = 1

#A constant that specifies an executable action.

ActionTypeExec = 0

#********************************************************

# Create the TaskService object.

service = win32com.client.Dispatch("Sche

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值