System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo.CreateNoWindow = true;
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.FileName = "ipconfig";
p.StartInfo.Arguments = "/all";
p.Start();
p.WaitForExit();
string s = p.StandardOutput.ReadToEnd();
string temp = s.Substring(s.IndexOf("Physical Address. . . . . . . . . :") + 36, 17);
//MessageBox.Show(s.Substring(s.IndexOf("Physical Address. . . . . . . . . :") + 36, 17));
Label1.Text = temp;
获取MAC地址。。。。。。。。。
C#获取网卡MAC地址
最新推荐文章于 2024-05-06 16:21:53 发布
本文介绍了一段使用C#编程语言来获取计算机网卡MAC地址的代码实现。通过创建并启动一个进程来执行ipconfig /all命令,然后解析输出结果以提取所需的MAC地址。
499

被折叠的 条评论
为什么被折叠?



