Zalak Parikh

Zalak Parikh

  • NA
  • 13
  • 1.7k

Run an executable file from windows service

Aug 19 2019 6:41 AM
I created a windows service with Process.start(filepath) in it. But it is neither working nor showing any errors. I got the file as a background process in the task manager.

I tried BackgroundWorker with DoWorkEventHandler delegate to start the process. But I failed to start the process.

I also tried with ProcessStartInfo and UseShellExecute as false but it is not working.
  1. Process prs = new Process();
  2. string strAppPath;
  3. strAppPath = "C:\\WINDOWS\\SYSTEM32\\notepad.exe";
  4. prs = Process.Start(strAppPath);
  5. prs.WaitForExit();
  6. base.Stop();

Answers (2)