发布网友 发布时间:2022-03-24 21:10
共1个回答
热心网友 时间:2022-03-24 22:40
是用来获取MAC地址用的
string mac = "";
System.Diagnostics.Process process = new System.Diagnostics.Process();
process.StartInfo.FileName = "nbtstat";
process.StartInfo.Arguments = "-a " + Lghostip;
process.StartInfo.UseShellExecute = false;
process.StartInfo.CreateNoWindow = true;
process.StartInfo.RedirectStandardOutput = true;
process.Start();
string output = process.StandardOutput.ReadToEnd();
int length = output.IndexOf("MAC Address =");
if (length > 0)
{
mac = output.Substring(length + 14, 17);
}
Lghostmac = mac;