all groups > dotnet clr > may 2005 >
You're in the

dotnet clr

group:

.NET Windows Service Question - Ho to determine directory where service executable is?


Re: .NET Windows Service Question - Ho to determine directory where service executable is? Mattias Sjögren
5/27/2005 12:00:00 AM
dotnet clr:

[quoted text, click to view]

Try checking

System.Reflection.Assembly.Loacation

on your own assembly.



Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
.NET Windows Service Question - Ho to determine directory where service executable is? Joe Rattz
5/27/2005 10:55:08 AM
I can't seem to find the appropriate news group to post this question to so
sorry if this isn't it.

I have a C# .NET windows service. I want my service to be able to load some
files from its install directory at runtime. However, when the service is
running, the current directory is c:\winnt\system32. How do I determine the
directory that the service's executable was run from?

Thanks.

Re: .NET Windows Service Question - Ho to determine directory where service executable is? Joe Rattz
5/27/2005 1:36:08 PM
That's it, thanks. More specifically its:

System.Reflection.Assembly.GetExecutingAssembly().Location



[quoted text, click to view]

AddThis Social Bookmark Button