本文介绍了使用c#代码运行命令行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好。
请尝试使用c#代码运行以下命令行来停止假脱机程序
sc Stop Spooler
如何使用进程c#停止它?
我的代码
Hello all
please i try to stop Spooler by run the following command line using c# codesc Stop Spooler
how can i stop it using process c# ?
my code
Process P = Process.start ( ???? );
thread.sleep(500);
setparent(p.MainWindowHandle,this.Handle);
推荐答案
ServiceController controller = new ServiceController("Spooler");
controller.Stop();
service.WaitForStatus(ServiceControllerStatus.Stopped);
这篇关于使用c#代码运行命令行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!