472,145 Members | 1,530 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,145 software developers and data experts.

Setting command line arguments for a service at install time

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.

Nov 21 '05 #1
1 7706
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].
"amirmira" wrote:
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.

Nov 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Hari | last post: by
6 posts views Thread by Jon Hewer | last post: by
3 posts views Thread by Shailesh Humbad | last post: by
2 posts views Thread by Russ P. | last post: by
4 posts views Thread by Keith Hughitt | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.