Is there a way to create a second console to output to in .NET when writing a console application?(编写控制台应用程序时,有没有办法创建第二个控制台以在 .NET 中输出?)
问题描述
在编写控制台应用程序时,有没有办法在 .NET 中创建第二个控制台以输出到?
Is there a way to create a second console to output to in .NET when writing a console application?
推荐答案
好吧,你可以启动一个新的 cmd.exe 进程,并使用 stdio 和 stdout 发送和接收数据.
Well, you could start a new cmd.exe process and use stdio and stdout to send and recieve data.
ProcessStartInfo psi = new ProcessStartInfo("cmd.exe")
{
RedirectStandardError = true,
RedirectStandardInput = true,
RedirectStandardOutput = true,
UseShellExecute = false
};
Process p = Process.Start(psi);
StreamWriter sw = p.StandardInput;
StreamReader sr = p.StandardOutput;
sw.WriteLine("Hello world!");
sr.Close();
更多信息 MSDN.
这篇关于编写控制台应用程序时,有没有办法创建第二个控制台以在 .NET 中输出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:编写控制台应用程序时,有没有办法创建第二个控制台以在 .NET 中输出?


基础教程推荐
- 有没有办法忽略 2GB 文件上传的 maxRequestLength 限制? 2022-01-01
- MS Visual Studio .NET 的替代品 2022-01-01
- c# Math.Sqrt 实现 2022-01-01
- rabbitmq 的 REST API 2022-01-01
- 为什么Flurl.Http DownloadFileAsync/Http客户端GetAsync需要 2022-09-30
- 将 XML 转换为通用列表 2022-01-01
- 如何激活MC67中的红灯 2022-01-01
- 将 Office 安装到 Windows 容器 (servercore:ltsc2019) 失败,错误代码为 17002 2022-01-01
- SSE 浮点算术是否可重现? 2022-01-01
- 如何在 IDE 中获取 Xamarin Studio C# 输出? 2022-01-01