I'm currently having an issue where I'm trying to get the output of the command "arp -a" from CMD in my C# .net program
Process p = null;
string output = string.Empty;
try
{
p = Process.Start(new ProcessStartInfo("arp", "-a")
{
CreateNoWindow = true,
UseShellExecute = false,
RedirectStandardOutput = true
});
output = p.StandardOutput.ReadToEnd();
Console.WriteLine(output);
p.Close();
}
catch(Exception e)
{
throw new Exception("Error", e);
}
I expect to get some sort of string value in the "output" variable, but all I get is a blank "". I did test if it worked in the first place by changing it to
p = Process.Start(new ProcessStartInfo("ipconfig")
and my "output" variable was filled with what you would expect if you typed in ipconfig into CMD, so i know it worked.
any ideas?