VB.NET Windows Service - Start Parameters

  • Thread starter Thread starter Guest
  • Start date Start date
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 !
 
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.
 
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"
 
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
 
Back
Top