Creating a service using C #

I need to create a service using C # and sc.exe when I try to execute

C:\Windows\system32\sc.exe create ServiceName binPath= D:\work\ServiceExe.exe,

It works great. 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 specified file .

What could it be? File exists, uninstall service before reinstalling.

+3
source share
2 answers

You must use another overload Process.Startthat takes arguments as a separate parameter.

Process.Start(@"C:\Windows\system32\sc.exe", "create ServiceName binPath= D:\work\ServiceExe.exe")
+9
source

, , / .

-1

All Articles