Click to See Complete Forum and Search --> : Get the default application path


enigmaos
August 8th, 2002, 12:07 PM
How do I get the default application path for a service?

Application.StartupPath does not work.

DSJ
August 8th, 2002, 12:11 PM
application.ExecutablePath maybe?

enigmaos
August 8th, 2002, 12:45 PM
Application doesn't work in service.

whooper
August 8th, 2002, 01:19 PM
The application object probably doesn't work becuase the service actually runs under the Service Control Manager.

There may be an easier way (and there probably is), but when you register your service, an entry in made in the registry that has the path to the executable. You could try reading from the registry.

DSJ
August 8th, 2002, 02:26 PM
Give this a whirl:

MsgBox(System.Reflection.Assembly.GetExecutingAssembly.Location)

dinesh123
August 15th, 2002, 07:20 AM
Can't u get that from registry

Key = HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Service Name\Parameters

String Value = AppDirectory