how obtain the executable directory of a window service

  • Thread starter Thread starter Willie wjb
  • Start date Start date
W

Willie wjb

Hi,

i created a windows service. This service is installed in some c:\program
files\x directory
when started it needs the directory in which it is started.

when i use the system.environment.currentdirectory i get the
C:\WINNT\SYSTEM32 in stead of the
c:\program files\x.

i think the windows service is started by another program out of the
system32 dir.
Is there a (simple) way to get the c:\program files\x direcotry where the
executable is located.

thanks.
 
Is there a (simple) way to get the c:\program files\x direcotry where the
executable is located.

Assembly.GetExecutingAssembly().Location



Mattias
 

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

Back
Top