Windows service's current directory

  • Thread starter Thread starter Mike
  • Start date Start date
M

Mike

I developed a Windows service, and I want to access a
file I want to have on the same folder the service is in.

Q: How one can obtain a service's current directory, the
directory where it physically resides?

When I use System.Environment.CurrentDirectory it gives
me System32 folder path instead.

Thanks,
Mike
 
Thanks Martin! It works. Also, I found out that the
Environment.CommandLine serves the purpose too.

Mike
 

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