Please help - How to get the Path of Executable of a Windows Service...
-
Monday, February 06, 2006 8:21 AM
Dear Experts,
I would like to get the parameter "Path to Executable" of a Windows Service programmatically. As you know, we can use Service MMC snap-in (Control Panel --> Services) to adminstrate Windows Services. If you right click any one of the Windows Services and then choose Properties, you would see the Service snap-in.
In the Service snap-in, there is an item called "Path to Executable" that shows you the original location of your Windows Service's executable. Now I would like to get this path programmatically. Could you please tell me how I can achieve that?
Many thanks for your help. :-)
Tigger
Answers
-
Monday, February 06, 2006 2:53 PM
You can find the command line used to launch each service in the registry at HKLM/System/CurrentControlSet/Services/<servicename>/ImagePath. Maybe that will get you enough for your purposes.
All Replies
-
Monday, February 06, 2006 2:53 PM
You can find the command line used to launch each service in the registry at HKLM/System/CurrentControlSet/Services/<servicename>/ImagePath. Maybe that will get you enough for your purposes.
-
Monday, February 06, 2006 2:55 PM
In order to do this you must dive into the HKEY_LOCAL_MACHINE bowels of the registry I fear, all the way to:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\service name
Within the key of your chosen service name you will find a value pair named ImagePath which is associated with the path to the service complete with any related arguments.
-
Wednesday, August 24, 2011 3:00 PM
In order to do this you must dive into the HKEY_LOCAL_MACHINE bowels of the registry I fear, all the way to:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\service name
Within the key of your chosen service name you will find a value pair named ImagePath which is associated with the path to the service complete with any related arguments.
And there is no way to query some windows component to find it?

