473,325 Members | 2,308 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 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 7865
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Hari | last post by:
can i have command line arguments in VS.NET applicatio? if yes how? Can i have some code snippets of the above functionality? I know we can acjieve this in console application form command...
1
by: rforman1 | last post by:
I have found many threads with this question asked and ostensibly answered, but none with an example of how exactly to do it. Help! I know that in order to set up the values of command line...
6
by: Jon Hewer | last post by:
hi i am writing a little script and currently implementing command line arguments following the guide by mark pilgrim from dive into python; ...
7
by: Steve M | last post by:
I'm trying to invoke a Java command-line program from my Python program on Windows XP. I cannot get the paths in one of the arguments to work right. The instructions for the program describe the...
1
by: mriedel | last post by:
I'm using the InstallContext class to parse the command-line arguments of a console application. The arguments are in the form of "-file=myFile.txt -flag", and the InstallContext object gives me what...
3
by: Shailesh Humbad | last post by:
I want to set a command-line argument for a Windows service that I programmed in VB.Net. This ought to be available from the service installer classes, but I can not find any such property. What...
2
by: Russ P. | last post by:
Is it possible to pass command-line arguments when running a program in IDLE? The "Run" menu does not seem to provide that option. Thanks.
4
by: Keith Hughitt | last post by:
Hi all, I am using someone else's script which expects input in the form of: ./script.py <arg1arg2 I was wondering if the angle-brackets here have a special meaning? It seems like they...
4
by: tvrdak | last post by:
Hello, I would like to register service to start with some arguments - meaning command line arguments of service itself. The best approach was some articles about selfregistrating service, like...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.