How can a Windows Service start a process when a Timer event is raised?

I have created a Windows Service with Timer and in firing event of timer.Elapsed I am creating a process (System.Diagnostics.Process.Start(exe path)) at interval of 5 seconds. But this process does not get created on the firing of an event.

Is there any other way of doing this?

Thanks in advance.

private void timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{       

    Process pr = new Process();
    pr.StartInfo.FileName = @"C:\Program Files\Messenger\msmsgs.exe";
    pr.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
    pr.StartInfo.CreateNoWindow = false;
    pr.Start();
}
7
задан Cody Gray 23 December 2010 в 05:58
поделиться