using System.Diagnostics;
namespace WinFormsApp1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
var process = new Process()
{
StartInfo = new ProcessStartInfo
{
FileName = "cmd.exe",
Arguments = "/c ipconfig",
RedirectStandardOutput = true,
}
};
process.Start();
string output = process.StandardOutput.ReadToEnd();
process.WaitForExit();
MessageBox.Show(output);
}
}
}
/*
run:
\r\nWindows IP Configuration\r\n\r\n
\r\nEthernet adapter Ethernet:\r\n\r\n
Connection-specific DNS Suffix . :
\r\n IPv6 Address. . . . . . . . . . . : ...
*/