This project has moved. For the latest updates, please go here.

Open Task Scheduler

Jan 19, 2011 at 11:45 PM
Edited Jan 19, 2011 at 11:45 PM

Is there a simple, consistent way to open the Task Scheduler itself from C# or VB.Net, no matter what OS you're on? I thought this would work on any system, but it doesn't on Windows 7, although it works on XP:

For Each oTask As TaskScheduler.Task In ts.RootFolder.Tasks

   bTasksFound = True
   Process.Start("explorer.exe " & jnFunctions.jnGetDirectoryPathPart(oTask.Path))

  'Just run once
  Exit For

Next

 

Start, Run commands available:

Windows 7: "task"

XP: "control schedtasks"

Vista: "taskschd.msc"

 

Any ideas for something consistent?

Thanks!

Coordinator
Jan 20, 2011 at 4:19 AM

I am not 100% confident, but I believe the following code should work on all versions XP and later:

Process.Start("control.exe", "schedtasks");

Jan 24, 2011 at 8:15 PM

Just a follow-up to this, there appears to not be one command that works on all machines (which is quite dumb of Microsoft). Stuff like this baffles me. There's no reason to not have an API for this.

That said, I simply created Select Case code based on the OS, and I call different commands for different OS. As a backup, I have an INI setting that can be configured if none of my built-in logic works.

Thanks.

Coordinator
Jan 24, 2011 at 10:08 PM

If you will post that code, I will include it in the library in the TaskService class as a static method.