2013-07-08 61 views
1

我正在研究調度任務的python腳本。我創建了從那裏用戶安排他task.The的GUI如下圖所示如何使用python安排任務

enter image description here 現在我的腳本必須從這個GUI接收輸入和安排task.I知道命令行參數的GUI:

TASKNAME - >/TN 開始日期 - >/SD 開始時間 - >/ST 選擇一週中的一天 - >/d

我的問題是,什麼是命令行參數「岑參每天「和」每週重複「來安排任務?

回答

0

這裏是一個Python腳本計劃任務,

FOR ONE TIME

cmd='SCHTASKS /Create /SC "%s" /TN "%s" /TR "%s" /SD "%s" /ST "%s"'%("ONCE","calc","C:\Windows\System32\calc.exe","10/07/2013","11.47") 
proc=subprocess.Popen(cmd,shell=True,stdout=subprocess.PIPE,stderr=subprocess.PIPE) 

每天,每2天

cmd='SCHTASKS /Create /SC "%s" /MO "%s" /TN "%s" /TR "%s" /SD "%s" /ST "%s"'%("DAILY","2","calc","C:\Windows\System32\calc.exe","10/07/2013","11.47") 
proc=subprocess.Popen(cmd,shell=True,stdout=subprocess.PIPE,stderr=subprocess.PIPE) 

每星期一FOR每2周

cmd='SCHTASKS /Create /SC "%s" /MO "%s" /D "%s" /TN "%s" /TR "%s" /SD "%s" /ST "%s"'%("DAILY","2","MON","calc","C:\Windows\System32\calc.exe","10/07/2013","11.47") 
proc=subprocess.Popen(cmd,shell=True,stdout=subprocess.PIPE,stderr=subprocess.PIPE)