在C#中查询Netsh [英] querying netsh in c#
本文介绍了在C#中查询Netsh的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我一直在尝试提出一种使用C#查询WiFi信息的理想方法.我已经尝试过 netsh
方法,但是不确定如何分隔信息.我注意到 Vistumbler
使用了 netsh
.这些开发人员是否有办法在查询 netsh
时分离信息,或者只是执行大量的字符串操作以删除不相关的内容.
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.
推荐答案
我通常这样做.调用 netsh
,获取输出并进行解析.
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
这篇关于在C#中查询Netsh的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文