1

I want to run a console application from windows service using threading and want to pass a string as a argument.

Thread t =new Thread(new ThreadStart(() => ThreadFunction())); t.Start();

ThreadFunction() { Process p.StartInfo = new ProcessStartInfo("Prog.exe"); p.Start(); }

Thanks in advance!

Pran
  • 155
  • 11
  • Are you looking to interact with the service or just watch it through its cycle. Have you tried anything yourself? I know this is possible as I have or did have some code that will show you how to do it. I just need to dig it out – Simon Price Apr 12 '18 at 15:50
  • i tried like this Thread t =new Thread(new ThreadStart(() => ThreadFunction())); t.Start(); ThreadFunction(){ objProcess.StartInfo = new ProcessStartInfo("Prog.exe"); objProcess.Start(); } – Pran Apr 12 '18 at 15:52
  • please edit your question and show more of your code – Simon Price Apr 12 '18 at 15:54
  • `Thread` is for fire-and-forget threads where you are not expecting any response. If you want to get a response from a console app; even to see if the process got an error, you should use [`ProcessStartInfo`](https://stackoverflow.com/questions/139593). – Dour High Arch Apr 12 '18 at 17:11

0 Answers0