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?

link|improve this question
Are they WinXP? – M'vy Mar 25 '11 at 11:09
WinXP and also Win7. I found an other way - I use C# now. – RaveKev Mar 29 '11 at 6:22
feedback

1 Answer

up vote 1 down vote accepted

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);

        }
link|improve this answer
Hmm... that C# way doesn't work on WinXP.... any help? – RaveKev Apr 20 '11 at 13:24
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.