我一直在寻找解决方案,以使用python 3结束预定任务。
我已经成功地结束了预定的任务,但是我必须结束“事件查看器任务”。
我使用当前代码结束预定任务;
def endScheduledTasks():
os.system('schtasks /end /tn testSync')
我假设要结束事件查看器任务,我需要输入以下内容;
def endEventTasks():
os.system('eventviewertask /end /tn Replication')
对此进行任何输入都会很有帮助!
答案 0 :(得分:1)
在您的命令中
os.system('schtasks /end /tn testSync')
testSync是什么? 如果这是进程的名称,那么您会出错。 外观:
/TN taskname Specifies the path\name of the task to terminate.
尝试使用“ path_to_task \ and_name_of_task” 例如:
schtasks /end /tn "\Microsoft\XblGameSave\XblGameSaveTask"
有关路径和任务名称:
schtasks