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


在Linux上运行ASP.NET网站或WebApi的传统步骤是,先安装libgdiplus,再安装mono,然后安装Jexus。在这个过程...
这两天广州的温度26度+,都开始穿短袖短裤了。。。
今年的天气真的很异常啊,经常大暴雨的。尤其是这几天,几乎每天晚上凌晨都会被大暴雨和雷声吵醒。。。
