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


之前有传闻说iPhone5自带的地图,钓鱼岛划给的是日本.我认为不会出现这样的情况,这样无疑会让大家地址苹果的....
为了安全起见,最好每天将sql server数据备份一次。每天都手动去备份,太耗费时间了,如果一忙,还给忘记了,...
