0
Reply

How to start process with Windows service

Andris

Andris

Nov 10 2007 10:32 AM
1.8k
Hi, I created a Windows service and I'd like to start a new process from it. So far it was made clear for me that a service cannot start a visible process, because it has no "screen" to start on. My service has to make a log off from windows. So I created this: Process p = new Process(); p.StartInfo.FileName = "shutdown.exe"; p.StartInfo.Arguments = "-l"; p.StartInfo.UseShellExecute = false; p.Start(); Apparently it is not executed properly because the system doesn't log off. Of course when I attach the service to my Visual Studio, it works. How can I call the logoff from my service?