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. example of service info in services.msc (see executable path exists there)

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

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -