Get Windows service executable path

Settembre 3rd, 2007

Description: Returns absolute path to the folder where the running service’s executable is located

Link: http://www.codekeep.net/snippets/eb2e15ed-e97c-4037-af70-8bbba71103c8.aspx

private string servicePath
{
	get
        {
		return Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName);
	}
}

  • .NET
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Trackback URI | Comments RSS

Leave a Reply

You must be logged in to post a comment.