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


Access数据库添加字段的方法alter table T1 add column 字段名称 类型如:alter table config_info add colu...
更新新版本酷狗后,发现后我经常听的歌曲全变成了VIP才能听的歌曲..我以为就我一个人出现的这样,结果查了一下...
如果你的网站网站每天的访问量非常大的话,相信会产生非常多的日志,如果这些日志对你来说没什么用处的话,还...
