现在的位置: 首页 > 综合 > 正文

用C#调用DOS命令获取本机网卡的MAC地址?

2013年08月30日 ⁄ 综合 ⁄ 共 365字 ⁄ 字号 评论关闭
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();
MessageBox.Show(s.Substring(s.IndexOf("Physical Address. . . . . . . . . :")+36,17));

抱歉!评论已关闭.