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.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
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