Windows service - supplying arguments in "path to executable"

Posted by Jono on Stack Overflow See other posts from Stack Overflow or by Jono
Published on 2010-06-07T13:50:18Z Indexed on 2010/06/07 14:22 UTC
Read the original article Hit count: 205

Filed under:
|

I cannot figure out how to pass (constant) arguments into my Windows service when it is started. I'm using the standard .NET classes like ServiceBase to implement (and ServiceProcessInstaller and ServiceInstaller to install) my service.

On the general tab of a Windows Service properties dialog box (once installed), there's a "Path to executable" in which I can see that some of the standard Windows services have command line arguments specified. System.ServiceProcess.ServiceBase.OnStart takes string[] args, which I presume would enable these arguments to be accessed from within .NET code.

Are there some properties on ServiceProcessInstaller or ServiceInstaller that I can set to allow me to pass startup arguments to my own service, or does anyone know how it's supposed to be done?

© Stack Overflow or respective owner

Related posts about .NET

Related posts about windows-services