I have a windows service and I need to create directory to store some info. The directory path must be relative to the windows service exe file. How can get this exe file pa
This did the trick for me
Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
Tip: If you want to find startup path of installed windows service, look here from registry .
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\ + ServiceName
There are keys about windows service
You can use AppDomain.CurrentDomain.BaseDirectory