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
 
Back
Top