C# CMD回显

2019年8月2日 0 条评论 1.87k 次阅读 0 人点赞
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)

你必须 登录 才能发表评论