You can analyze the command line arguments at startup, and configure the
service entry in the SCM that it runs your exe with a specific argument, say
"-service". If no command-line args are supplied, don't run
System.ServiceProcess.ServiceBase.Run, but display a help message instead.
>I have a Windows service exe that derives from
> System.Configuration.Install.Installer
[quoted text clipped - 14 lines]
> run from the command line while still behaving properly when running as a
> service.
PIEBALD - 23 Mar 2006 16:19 GMT
> You can analyze the command line arguments at startup, and configure the
> service entry in the SCM that it runs your exe with a specific argument, say
> "-service". If no command-line args are supplied, don't run
That seems a bit kludgy and I don't see where to do it anyway.
I've looked through the properties and methods for:
System.Configuration.Install.Installer
System.ServiceProcess.ServiceProcessInstaller
System.ServiceProcess.ServiceInstaller
System.ServiceProcess.ServiceBase
and not seen anything like a place to put parameters. Nor any way for
INSTALLUTIL to pass them.
I got it...
System.Environment.UserInteractive