How to get System.Diagnostic.Process to launch Windows Task Scheduler

Posted on 2013-10-02
Medium Priority
Last Modified: 2013-10-03
I have a simple button click in a WPF application that launches the Windows Task Scheduler.  

        private void LaunchTaskScheduler_Click(object sender, RoutedEventArgs e)
            var taskscheduler = Environment.GetFolderPath(Environment.SpecialFolder.SystemX86) + @"\taskschd.msc";

            Process p = new Process();
            p.StartInfo.UseShellExecute = false;
            p.StartInfo.FileName = taskscheduler;
            p.StartInfo.CreateNoWindow = true;


Open in new window

I have used this approach in the past in the WinForms world with no issue.  Can anyone see/know what I am doing wrong?
Question by:Todd710
LVL 64

Accepted Solution

Fernando Soto earned 2000 total points
ID: 39541145
Hi Todd710;

In order to execute this type of application, taskschd.msc, you will need to use the true value in the UseShellExecute parameter as follows.

p.StartInfo.UseShellExecute = true;

A false value here will only run executable file types, .exe, the shell knows what to do with this type.

Author Closing Comment

ID: 39542850
You are absolutely correct!  Thanks for the help!  Additionally I discovered that you can do this too:

var taskscheduler = Environment.GetFolderPath(Environment.SpecialFolder.SystemX86) + @"\taskschd.msc";


Which does exactly what you said as it uses the default ShellExecute.

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This article describes and provides a custom-made tool I wrote to give businesses a means of identifying commercial music content, without having to expend too much effort. Business recordings are easily identified from possibly illegal music files …
Watch the video to know how one can repair corrupt Exchange OST file effortlessly and convert OST emails to MS Outlook PST file format by using Kernel for OST to PST converter tool. It can convert OST to MSG, MBOX, EML to access them. It can migrate…
Through the video, you can check the migration process of Outlook PST file to PDF. Kernel for Outlook to PDF tool can convert Outlook emails with all attributes like Subject, To, From, Cc, Bcc and other folders such as Inbox, Outbox, Sent Items, Jun…

586 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question