How to get service execuable path
来源:互联网 发布:苏霍伊和米高扬知乎 编辑:程序博客网 时间:2024/05/21 08:38
Some time we need to get specific service path and then do something you want. there are 2 way to get specific service path bellow.
private static string GetRegistData(string name){string registData;RegistryKey hkml = Registry.LocalMachine;RegistryKey system = hkml.OpenSubKey("SYSTEM", true);RegistryKey currentControlSet = system.OpenSubKey("CurrentControlSet", true);RegistryKey services = currentControlSet.OpenSubKey("services", true);RegistryKey key = services.OpenSubKey(name, true);registData = key.GetValue("ImagePath").ToString();return registData;}private static string GetServicePath(string name){ManagementClass mc = new ManagementClass("Win32_Service");foreach (ManagementObject mo in mc.GetInstances()){if (mo.GetPropertyValue("Name").ToString() == name){return mo.GetPropertyValue("PathName").ToString().Trim('"');}}return string.Empty;}
1 0
- How to get service execuable path
- how to get current path in qt
- How to get file path in onActivityResult in Android 4.4
- How to get a path to a resource in a Java JAR file
- how to get?
- How to Get Insights?
- how to get gril
- how to get UDID
- Windows service HOW-TO
- How to get Parent Channel
- how to get a polygon
- How to Get Mac Address
- How to get selected text
- How to get battery info
- How to get currency symbol?
- How to get a solution?
- how to get session information
- How to Get the WDK
- SAT句子填空题10个示例及答案
- 大家开发完APP有检测过漏洞吗?
- 一键导出excel
- Openstack keystone setup.py和setup.cfg的解析
- python 的sqlite3连接模块用法
- How to get service execuable path
- Codeforces Round #306 (Div. 2)
- 为Runner做一张有质感的图
- 新GRE阅读关于Emily Dickinson 的作品
- Java中的正则表达式中的中文
- Stanford公开课机器学习---week3-1.Logistic Regression 逻辑回归
- IO类
- jQuery的三种$()
- 【扫盲贴!】微信公众平台开发需要懂哪些技术