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;
相关文章
文章评论
热门评论
暂无评论


netstat -an|find "ESTABLISHED" /c更多资料请点击:https://www.cnblogs.com/tudachui/p/9889741...
在使用淘宝营销工具单品宝时,提示:最终优惠力度应高于店铺最低折扣,如下图:这样就导致无法进入下一步,我...
晚上搜索关键词,发现百度变样了.我以为我的被劫持了.后来刷新发现还是新版.如图.只是有强迫症的我,看到左侧是...
