Accessing app path info inside a service

FrankenPC

New member
Joined
Nov 28, 2007
Messages
4
Programming Experience
10+
Hello,

I'm trying to figure out how to determine the relative path to the service EXE file programatically. In a normal desktop application you can simply read the Directory.GetCurrentDirectory value.

In a service, however, the relative path points to the C:\Windows\System32 directory.

Short of using a registry key, how can I point to the service EXE's execution path?

Thanks much!
 
Ok, the reflection location doesn't work. At least with the .NET 2.x framework.

So, I guess I'll do a registry lookup @: HKLM\System\CurrentControlSet\Services to find the actual EXE install location.
 
Back
Top