CmdProcess.StartInfo.FileName = "cmd"; // 命令
CmdProcess.StartInfo.Arguments = ""; // 参数
CmdProcess.StartInfo.WorkingDirectory = Application.StartupPath;// 工作路径
CmdProcess.StartInfo.CreateNoWindow = true; // 不创建新窗口
CmdProcess.StartInfo.UseShellExecute = false;
CmdProcess.StartInfo.RedirectStandardInput = true; // 重定向输入
CmdProcess.StartInfo.RedirectStandardOutput = true; // 重定向标准输出
CmdProcess.StartInfo.RedirectStandardError = true; // 重定向错误输出
//CmdProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
CmdProcess.OutputDataReceived += p_OutputDataReceived; //输出事件
CmdProcess.ErrorDataReceived += p_OutputDataReceived;
CmdProcess.Start();
CmdProcess.BeginOutputReadLine();
CmdProcess.BeginErrorReadLine();
//接收回调接口函数
private void p_OutputDataReceived(object sender, DataReceivedEventArgs e){
}
© 著作权归作者所有
文章评论(0)