2014-06-24 26 views
0

我知道有一個用於查找計算機的計劃任務的命令,但我想要獲得關於計劃任務本身的更多信息。我想知道計劃任務的執行時間和時間,以及計劃任務的名稱和區域。有任何想法嗎?用於查找計劃任務嚮導任務信息的腳本

+0

爲也發現同樣的命令列出的屬性。 'schtasks/query/tn「Task Name」/ v/fo list' – phd443322

+0

@ phd443322這很好,謝謝 – giacmeister

回答

0
Set TS = CreateObject("Schedule.Service") 
TS.Connect("Serenity") 

Set rootFolder = TS.GetFolder("\") 

Set tasks = rootFolder.GetTasks(0) 

If tasks.Count = 0 Then 
    Wscript.Echo "No tasks are registered." 
Else 
    WScript.Echo "Number of tasks registered: " & tasks.Count 

    For Each Task In Tasks 
    A=Task.Name 
    A = A & " " & Task.NextRunTime 
    wscript.echo A 
    Next 
End If 

從幫助中,其中一些是其他信息的對象。

RegisteredTask

腳本對象,它提供了用於立即運行任務,獲得任務的所有正在運行的情況下,獲取或設置用於註冊任務憑據的方法,以及描述屬性任務。

方法 RegisteredTask對象定義了以下方法。

Method Description 
GetInstances Returns all instances of the registered task that are currently running. 
GetSecurityDescriptor Gets the security descriptor that is used as credentials for the registered task. 
GetRunTimes Gets the times that the registered task is scheduled to run during a specified time. 
SetSecurityDescriptor Sets the security descriptor that is used as credentials for the registered task. 
RunEx Runs the registered task immediately using specified flags and a session identifier. 
Stop Stops the registered task immediately. 
Run Runs the registered task immediately. 

屬性 RegisteredTask對象具有以下屬性。

Property Description 
Definition Gets the definition of the task. 
Enabled Gets or set a Boolean value that indicates if the registered task is enabled. 
LastRunTime Gets the time the registered task was last run. 
LastTaskResult Gets the results that were returned the last time the registered task was run. 
Name Gets the name of the registered task. 
NextRunTime Gets the time when the registered task is next scheduled to run. 
NumberOfMissedRuns Gets the number of times the registered task has missed a scheduled run. 
Path Gets the path to where the registered task is stored. 
State Gets the operational state of the registered task. 
XML Gets the XML-formatted registration information for the registered task. 

示例代碼[C++] 有關此腳本對象的詳細信息和示例代碼,見時間觸發實施例(腳本)和顯示任務名稱和國家(腳本)。

要求 客戶端需要Windows Vista。 類型庫使用Taskschd.tlb。

DLL需要Taskschd.dll。

另請參見 任務計劃程序對象 任務計劃

發送有關這個主題的評論微軟

構建日期:2006年10月2日 語言 C++

顯示所有 要求 客戶端需要Windows Vista。 類型庫使用Taskschd.tlb。

DLL需要Taskschd.dll。
請參見 任務計劃程序對象 任務計劃

發評論有關此主題的微軟

構建日期:2006年10月2日