我想使用 Python 3 结束计划任务。
我已成功结束计划任务,但我必须结束“事件查看器任务”。
我正在使用当前代码来结束计划任务;
def endScheduledTasks():
os.system('schtasks /end /tn testSync')
我假设要结束事件查看器任务,我需要输入以下内容;
def endEventTasks():
os.system('eventviewertask /end /tn Replication')
听从你的指挥
os.system('schtasks /end /tn testSync')
testSync 是什么? 如果这是进程的名称,那么您就会出错。 看:
/TN taskname Specifies the path\name of the task to terminate.
尝试使用“path_to_task nd_name_of_task” 例如:
schtasks /end /tn "\Microsoft\XblGameSave\XblGameSaveTask"
查看任务路径和任务名称:
schtasks