Question

I've been trying to come up with an ideal way to query WiFi information using C#. I've tried the netsh method but was unsure how to separate the information. I notice that Vistumbler uses netsh. Is there a way that these developers would have separated the information when querying netsh or have they just performed a lot of string manipulation to cut out the irrelevant stuff.

Was it helpful?

Solution

That is what I do usually. Call netsh, get the output and parse it.

Process p = new Process();
p.StartInfo.FileName = "netsh.exe";
p.StartInfo.Arguments = "netsh arguments...";
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.Start();

string output = p.StandardOutput.ReadToEnd();
// parse output and look for results
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top