c#执行bat方法
废话不多说,直接上代码....
ProcessStartInfo psi = new ProcessStartInfo("cmd.exe");
psi.CreateNoWindow = true;//不显示dos命令行窗口
psi.UseShellExecute = false;
psi.RedirectStandardOutput = true;
psi.RedirectStandardError = true;
psi.FileName = @"C:\Users\Jones.Zhao\Desktop\开启其它服务.bat";
// Start the process
System.Diagnostics.Process proc =System.Diagnostics.Process.Start(psi);
// Attach the output for reading
System.IO.StreamReader sOut = proc.StandardOutput;
proc.Close();
// Read the sOut to a string.
string results = sOut.ReadToEnd().Trim();
sOut.Close();
txtResult.Text=results;
相关文章
文章评论
热门评论
暂无评论


昨天京东买了一个小米手环4NFC版,今天上午到了,主要是用来监测睡眠和每天的运动量的.之前就想体验一下小米手...
当局者可能知道OFO目前退押金很难,说好的20个工作日,结果20个工作日过去了还是不一定能拿到押金.新闻也天天报...
打开支付宝的积分页面,就会出现这个功能,公告如下:亲爱的会员:自2020年5月1日0时起,支付宝积分有效期将调整...
