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


7年前写的一个软件,一直在360管家同类中排第一,13年后没再更新,排名从当初第一掉到现在第三,评分也从9.2分到...
每一个优秀的人,都有一段沉默的时光。那一段时光,是付出了很多努力,忍受了很多孤独和寂寞,不抱怨不诉苦,...
