Click here to Skip to main content
16,017,954 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all.
this is my Code :

ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = "sc.exe";
startInfo.Arguments = "\\192.168.0.165 start SpyService";
Process.Start(startInfo );

how can I stop and start Windows Services by sc.exe in c# .
I write this code but my application can not be run .
Posted

1 solution

"application can not be run" is surely not the correct description of the failure.
Because of that, I can give some suggestions only:
- startInfo.Arguments = @"\\192.168.0.165 start SpyService";
- run your program as administrator
- switch off firewalls
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900