2012-04-05 10 views
0

ローカルコンピュータにあるスケジュールされたタスクの一覧を取得する必要があります。C#を使用してスケジュールされたタスクのリストを取得する方法は?

Windows XPでC#を使用するとどうすれば実現できますか?

+4

何を試しましたか? –

+0

これを参照してください:http://stackoverflow.com/questions/6477693/c-sharp-how-to-list-scheduled-tasks-for-a-specific-user-with-the-taskschedular – nawfal

+0

@ErikLarsson私は試しましたどのようなnawfalが言ったが、私はいくつかのインポートが不足している 'ScheduledTask'クラスが解決されていません。 –

答えて

4

1の代替...:

1)タスクが保存されているフォルダ(アイブ氏はそれをテストしたから読み取ることができます - win7の)

c:\Windows\System32\Tasks\ 

がこのような単純なXMLファイルです:

<?xml version="1.0" encoding="UTF-16"?> 
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task"> 
    <RegistrationInfo> 
    <Date>2012-04-05T13:28:54.2106589</Date> 
    <Author>DAVIDDOM\RoyiN</Author> 
    </RegistrationInfo> 
    <Triggers> 
    <CalendarTrigger> 
     <StartBoundary>2012-04-05T13:28:43.2046589</StartBoundary> 
     <Enabled>true</Enabled> 
     <ScheduleByDay> 
     <DaysInterval>1</DaysInterval> 
     </ScheduleByDay> 
    </CalendarTrigger> 
    </Triggers> 
    <Principals> 
    <Principal id="Author"> 
     <RunLevel>LeastPrivilege</RunLevel> 
     <UserId>DAVIDDOM\RoyiN</UserId> 
     <LogonType>InteractiveToken</LogonType> 
    </Principal> 
    </Principals> 
    <Settings> 
    <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy> 
    <DisallowStartIfOnBatteries>true</DisallowStartIfOnBatteries> 
    <StopIfGoingOnBatteries>true</StopIfGoingOnBatteries> 
    <AllowHardTerminate>true</AllowHardTerminate> 
    <StartWhenAvailable>false</StartWhenAvailable> 
    <RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable> 
    <IdleSettings> 
     <Duration>PT10M</Duration> 
     <WaitTimeout>PT1H</WaitTimeout> 
     <StopOnIdleEnd>true</StopOnIdleEnd> 
     <RestartOnIdle>false</RestartOnIdle> 
    </IdleSettings> 
    <AllowStartOnDemand>true</AllowStartOnDemand> 
    <Enabled>true</Enabled> 
    <Hidden>false</Hidden> 
    <RunOnlyIfIdle>false</RunOnlyIfIdle> 
    <WakeToRun>false</WakeToRun> 
    <ExecutionTimeLimit>P3D</ExecutionTimeLimit> 
    <Priority>7</Priority> 
    </Settings> 
    <Actions Context="Author"> 
    <Exec> 
     <Command>C:\Windows\system32\charmap.exe</Command> 
    </Exec> 
    </Actions> 
</Task> 
+0

可能でしたが、nawfalの答えは行く方法です:) –

+0

信じられないほど便利です! – Ryan

関連する問題