brokeMyLegBiking
asked on
trying to run "NET START" command using ProcessStart
I have the following code, which I am trying to run to start my SQL server which I just installed. However, I get the error "the system cannot find the file specified."
--------
Dim p As New Process
p.StartInfo.FileName = "net start mssql$DATALINKDB"
p.Start()
p.WaitForExit()
-----------
do I need to add a prefix, or add the name of an actual program to execute the NET START statement or something?
Why not just:
Process.Start("net", "start mssql$DATALINKDB")
Process.Start("net", "start mssql$DATALINKDB")
I saw the code snippet and had to correct it immediately. Not perfect but working :-)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
excellent, the serviceController class is even better!
You have to separate the filename and its parameters:
Dim p As New Process
p.StartInfo.FileName = "net"
p.StartInfo.Arguments = "start mssql$DATALINKDB"
p.Start()
p.WaitForExit()