Is there any way to run command prompt commands from within a C# application? I need the name of a computer but the only way I can access it is by typing in to the cmd prompt.
nslookup myIPAdress
Like if my ip was 134.123.12.12 I would type;
nslookup 134.123.12.12
And the value it returns after Name: is what I am after. How would I get this in a c# console application?
I've already tried using
string name1 = Environment.MachineName;
Console.WriteLine(name1);
string name2 = System.Net.Dns.GetHostName();
Console.WriteLine(name2);
string name3 = System.Net.Dns.GetHostEntry("localhost").HostName;
Console.WriteLine(name3);
string name4 =DNSLookup("134.123.12.12");
string name5 = System.Net.Dns.GetHostEntry(134.123.12.12).HostName;
Console.WriteLine(name5);
But none of these produce the correct name, they just give me the server/host name of the computer. Any ideas?