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


做winform桌面端软件开发的小伙伴都会碰到软件在线升级的需求吧,我来讲下我的的实现思路,只是针对简单的在线...
命令如下:mysql -h主机地址-u用户名 -p用户密码
因为会生活家庭记账本是单机软件,你所有的数据都存在本地的电脑,并非存在云端服务器,所以才会出现这种换了...
