Get service path from services.msc c# -
i'm trying service executable path services.msc
i wrote next code:
var service = servicecontroller.getservices().where(p => p.servicename.equals("service name", stringcomparison.invariantcultureignorecase)); if (service.any()) //get service data
i couldn`t find (if @ all) service executable path located?
in services.msc can see path i'm assuming possible through code.
any ideas?
you can registry so:
private static string getserviceinstallpath(string servicename) { registrykey regkey; regkey = registry.localmachine.opensubkey(string.format(@"system\currentcontrolset\services\{0}", servicename)); if (regkey.getvalue("imagepath") == null) return "not found"; else return regkey.getvalue("imagepath").tostring(); }
Comments
Post a Comment