Determine a NT service's executable name ?

Thomas Heller theller at python.net
Tue Jun 24 10:56:59 EDT 2003


"Harald Schneider" <h_schneider at marketmix.com> writes:

> Hi,
>
> is there a possibility how to determine a services executable file name (and
> path) from within the service itself ?
>
> I need to create multiple services of the same application. The app needs to
> read a config file, which name depends on the name of the application's
> executable itself. So hardcoding it in the registry is no solution ...

sys.executable (although you should make sure that this returns the
right thing in the py2exe'd file)

win32api.GetModuleFileName(0)

Thomas




More information about the Python-list mailing list