0

I read this article passing parameters to services where it says to edit the ImagePath registry key in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\, but when I restarted my service this approach doesn't work.

If I start the service manually using a parameter it runs correctly, restarting the service fails to persist the parameter however and it didn't load from the registry either.

Is there another option for this short of an application config file?

1

1 Answer 1

0

The answer linked to by @HopelessN00b has the following comment from @Aaron:

Parameters entered through the dialog box are used only when the service is started manually .

That said, parameters are not passed to services using the 'normal' method (e.g., as command-line parameters); the service must be written to be able to read parameters passed by the ServiceManager. IOW, trying to access argv[] within the service will result in an empty array.

Rather, wrap the service's executable within a wrapper that will in turn invoke the actual service with the proper arguments.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .