首页 > 解决方案 > 隐藏窗口C#winform时如何打印出CMD命令的输出?

问题描述

我想在隐藏窗口时将使用 C# 将命令输入 CMD 的输出打印到文本框。到目前为止,这是我的代码:

double bytes = double.Parse(textBox2.Text);
string domain = url.Replace("https://", "");
string commands = "ping" + domain + "-t -l " + bytes;

var proc = new Process();
proc.StartInfo.FileName = "CMD.exe";
proc.StartInfo.Arguments = commands;
proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
proc.Start();

标签: c#winforms

解决方案


推荐阅读