4

I'm trying to add a scheduled task with

schtasks /create /tn bla /tn "c:\blabla.exe" /st 04:00:00 /sd 01/01/2011 /sc daily

this works on english Versions. But, when I try to fire that command on German systems it needs the /sc täglich option instead of /sc daily.

Is there a way to change that command so that it runs in every language environment?

Jawa
  • 3,679

1 Answers1

1

I am doing it now with C#.

using (TaskService ts = new TaskService())
        {

            // Create a new task definition and assign properties
            TaskDefinition td = ts.NewTask();
            td.RegistrationInfo.Description = "Does something";
            td.Principal.LogonType = TaskLogonType.InteractiveToken;

            // Run the service every hour.
            var tt = new TimeTrigger();
            tt.Repetition.Interval = TimeSpan.FromDays(1);
            tt.StartBoundary = DateTime.Today;

            td.Triggers.Add(tt);

            // Add an action that will launch someProgram.exe whenever the trigger fires
            td.Actions.Add(new ExecAction("c:\example.exe", null, null));

            // Register the task in the root folder
            const string taskName = "ExampleTask";
            ts.RootFolder.RegisterTaskDefinition(taskName, td);

            // Remove the task we just created
            // ts.RootFolder.DeleteTask(taskName);

        }