Setting command line arguments for a service at install time

G

Guest

I would like to set command line arguments to a service at install time. I
need to do this because I need to get information from different registry
locations depending on my command line argument. I have to do it this way as
the consumer of the service should not be able to change the argument -
except by uninstalling and reinstalling the service.

I created the service and the service itself works great. However, when I
try to install the service I get the following error:

"System.IO.FileNotFoundException: File or assembly name BDCC, or one of its
dependencies, was not found."

The command I am using to install the service is:
installutil StartUpParams.exe -a BDCC

I have also tried the following with no success:
installutil "StartUpParams.exe -a BDCC"
installutil [StartUpParams.exe -a BDCC]
installutil "StartUpParams.exe" -a BDCC
installutil "StartUpParams.exe" "-a BDCC"

Is there any way I can install the service with command line arguments? I
don't want to use "Start Parameters" from "Service Properties" as the end
user can change the the parameter without uninstalling the service first.
 
G

Guest

I was able to get to the install the service with command line arguments
using Installshield. However, I discovered that the command line arguments
are not passed to the OnStart mnethod of the service. Only the arguments
specified in the "startup parameters" section is passed to the service.

If you want to access the command line arguments for the service, the MAIN
subroutine must be overloaded with the arguments parameter [I just copied and
pasted the code from the OnStart method].
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top