1

毎日午後 3 時にタスクを実行する必要がありますが、バックグラウンド タスク ビルダーは、タスクが繰り返されるまで間隔を空けています。それを達成する方法は何ですか?(Windows 8.1 ユニバーサル アプリ)。

4

2 に答える 2

0

それが実際にあなたの環境である場合は、通常の Windows タスク スケジューラを使用することをお勧めします。これを行う方法を説明しますが、それは以前の回答の繰り返しになります: スケジュールされたタスクの作成

using System;
using Microsoft.Win32.TaskScheduler;

class Program
{
   static void Main(string[] args)
   {
      // Get the service on the local machine
      using (TaskService ts = new TaskService())
      {
         // Create a new task definition and assign properties
         TaskDefinition td = ts.NewTask();
         td.RegistrationInfo.Description = "Does something";

         // Create a trigger that will fire the task at this time every other day
         td.Triggers.Add(new DailyTrigger { DaysInterval = 2 });

         // Create an action that will launch Notepad whenever the trigger fires
         td.Actions.Add(new ExecAction("notepad.exe", "c:\\test.log", null));

         // Register the task in the root folder
         ts.RootFolder.RegisterTaskDefinition(@"Test", td);

         // Remove the task we just created
         ts.RootFolder.DeleteTask("Test");
      }
   }
}
于 2015-03-15T01:20:07.770 に答える