ServiceController.Start (line [])
I am trying to start a service with an argument that specifies a port number. For example, using DOS networking, I would do the following:
net start "SERVICENAME" /"ARGUMENT"
How would I do the same in C # using Service.Controller.Start ()?
0
Jim
source
to share
1 answer
This should work:
var sc = new ServiceController() { Name = "SERVICENAME" };
sc.Start(new string[] { "ARGUMENT" });
sc.WaitForStatus(ServiceControllerStatus.Running);
+2
Mark brackett
source
to share