How to get the below high lighted data from windows services
using c#
?
I have tried the below code to get the path to executable
private string GetInstallationPath(string serviceName)
{
ServiceController[] services = ServiceController.GetServices();
foreach (ServiceController service in services)
{
if (service.ServiceName == serviceName)
{
return service.GetType().Assembly.Location.ToString();
}
}
return string.Empty;
}
But it does not return the exe exutable path.