I need to create a service using C# and sc.exe utility when i try to execute
C:\Windows\system32\sc.exe create ServiceName binPath= D:\work\ServiceExe.exe
,
it works fine. But when i try to execute
Process.Start(@"C:\Windows\system32\sc.exe create ServiceName binPath= D:\work\ServiceExe.exe");
I have an exception, that the system cannot find the file specified.
What can it be? File exists, Service removing before re-install.
You should use another overload of Process.Start
which takes arguments as a separate parameter.
Process.Start(@"C:\Windows\system32\sc.exe", "create ServiceName binPath= D:\work\ServiceExe.exe")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With