By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,165 Members | 1,525 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,165 IT Pros & Developers. It's quick & easy.

application path of a service

P: n/a
Hello everyone,

This is probably a very simple and stupid question, but I cannot seem to
find the answer to it. How do I obtain the path of a windows service's
executable file? The Application.StartupPath does not work of course, since
the system.windows.forms assembly is not loaded. I tried
Environment.CurrentDirectory and System.IO.Directory.GetCurrentDirectory,
but they echoed the system32 directory.

Thanx,

Dmitry
Nov 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hello,

"Dmitry Akselrod" <dm*****@ddi.com> schrieb:
This is probably a very simple and stupid question, but
I cannot seem to find the answer to it. How do I obtain
the path of a windows service's executable file?


Maybe 'System.Reflection.Assembly.GetExecutingAssembly() .Location' works
(untested).

--
Herfried K. Wagner
MVP VB Classic, VB.NET
http://www.mvps.org/dotnet
Nov 20 '05 #2

P: n/a
That worked like a charm. Thank you so much!

Dmitry

"Herfried K. Wagner [MVP]" <hi*******@m.activevb.de> wrote in message
news:eO***************@TK2MSFTNGP12.phx.gbl...
Hello,

"Dmitry Akselrod" <dm*****@ddi.com> schrieb:
This is probably a very simple and stupid question, but
I cannot seem to find the answer to it. How do I obtain
the path of a windows service's executable file?


Maybe 'System.Reflection.Assembly.GetExecutingAssembly() .Location' works
(untested).

--
Herfried K. Wagner
MVP VB Classic, VB.NET
http://www.mvps.org/dotnet

Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.