Home
Manage Your Code
Snippet: Get Windows service executable path (C#)
Title: Get Windows service executable path Language: C#
Description: Returns absolute path to the folder where the running service's executable is located Views: 4958
Author: Szymon Kowalsky Date Added: 9/3/2007
Copy Code  
1private string servicePath
2{
3	get
4        {
5		return Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName);
6	}
7}
8
Notes
Since "./" means "Windows/System32" you can use this snippet to get the "real" location of your exe