public static void GetServices() {
var serviceList = new List<string>();
var servicePathList = new List<string>();
ServiceController[] services = ServiceController.GetServices();
foreach (var service in services)
{
serviceList.Add(service.DisplayName);
}
serviceList.Sort();
int serviceCount = 0;
foreach (var service in serviceList)
{
serviceCount++;
Console.WriteLine(serviceCount.ToString() + " - " + service);
}
}
Above code lists the names of the windows services installed. But I also want to get the Physical path of it. Any help?