anil maske

anil maske

  • NA
  • 143
  • 457

can i call .exe by using windows service? How?

Sep 21 2018 5:44 AM
I want to call My Windows application in windows service periodically. if application is not running then only run windows application.
 
My code is 
 
string _sApplicationPath = "PATH OF EXE"
if (Process.GetProcessesByName("APPLICATIONNAME/PROCESSNAME").Length > 0) { return; }
else
{
Process myProcess = new Process();
myProcess.StartInfo.UseShellExecute = false;
myProcess.StartInfo.FileName = _sApplicationPath;
myProcess.StartInfo.CreateNoWindow = true;
myProcess.Start();
}
 
it work in windows application but not work in windows Service.
 
Help. 

Answers (1)