-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
31 lines (28 loc) · 856 Bytes
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
using System;
using System.Diagnostics;
namespace NetshCommand
{
class Program
{
static void Main(string[] args)
{
// Execute the 'netsh int ipv4 show dynamicport tcp' command
var process = new Process()
{
StartInfo = new ProcessStartInfo
{
FileName = "netsh",
Arguments = "int ipv4 show dynamicport tcp",
RedirectStandardOutput = true,
UseShellExecute = false,
CreateNoWindow = true,
}
};
process.Start();
// Read the output of the command
string output = process.StandardOutput.ReadToEnd();
// Print the output to the console
Console.WriteLine(output);
}
}
}