How to get the path of the application being run?

K

K Viltersten

I have a service that create an instance of
a class Donkey that is compiled to an EXE
at the location c:\animals.

Since i run the thing as a service, i get
the working directory to be
c:\windows\system32
but i'd need to know what directory the
class is located in. That's where i'll have
my config files, namely.
 
D

Duggi

I have a service that create an instance of
a class Donkey that is compiled to an EXE
at the location c:\animals.

Since i run the thing as a service, i get
the working directory to be
  c:\windows\system32
but i'd need to know what directory the
class is located in. That's where i'll have
my config files, namely.

--
Regards
Konrad Viltersten
----------------------------------------
May all spammers die an agonizing death;
have no burial places; their souls be
chased by demons in Gehenna from one room
to another for all eternity and beyond.

Assembly.GetExecutingAssembly().Location should solve it..

-Cnu
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top