VB.NET Windows Service - Start Parameters

G

Guest

friends, romans, countrymen, lend me your ears....

I expect this question has a fairly simple answer; How do I obtain the start
parameters that have been set against my Windows Service in VB.Net ?

I was expecting to find a me.StartParameters but, alas, it is not there!

Drat !
 
G

Guest

My eagle eye has spotted this in the service OnStart event:

ByVal args() As String

Is args() what I'm looking for?

If so, why does it appear to be an array?

I would imagine the start-up parameters of a service would be a string
rather than an string array.
 
M

Michael.Suarez

the string will automatically be parsed for you, using a space as a
delimeter. so if your commandline is
program.exe command1 command2 command3

args(0) = "command1"
args(1) = "command2"
args(2) = "command3"
 
G

Guest

Hello

Make sure that the parameters are actually specified
in the "Path to executable" and not in the "Start Parameters".
I had the same problem that you had. I specified the
parameters in the "Start Parameters" section of the
service and it never worked. Added it via the registry to
executable path and it reflected in my service.

The registry key is HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services

Regards,
Simon
 

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