Vb.Net2013内如何获取网卡所有信息

Meet03 2014-05-05 12:09:42
如题,怎么获取本地网卡的所有信息,IP地址,网管,DNS,MAC还有网卡名字,还有怎么写IP地址等等。
...全文
290 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
VB小鱼 2014-05-23
  • 打赏
  • 举报
回复
API GetIfTable GetAdaptersInfo GetPerAdapterInfo GetNetworkParams
Meet03 2014-05-06
  • 打赏
  • 举报
回复
引用 6 楼 caozhy 的回复:
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = ExecuteCommandSync("ipconfig");
            Console.WriteLine(s);
        }
        static string ExecuteCommandSync(object command)
        {
            try
            {
                // create the ProcessStartInfo using "cmd" as the program to be run,
                // and "/c " as the parameters.
                // Incidentally, /c tells cmd that we want it to execute the command that follows,
                // and then exit.
                System.Diagnostics.ProcessStartInfo procStartInfo =
                    new System.Diagnostics.ProcessStartInfo("cmd", "/c " + command);

                // The following commands are needed to redirect the standard output.
                // This means that it will be redirected to the Process.StandardOutput StreamReader.
                procStartInfo.RedirectStandardOutput = true;
                procStartInfo.UseShellExecute = false;
                // Do not create the black window.
                procStartInfo.CreateNoWindow = true;
                // Now we create a process, assign its ProcessStartInfo and start it
                System.Diagnostics.Process proc = new System.Diagnostics.Process();
                proc.StartInfo = procStartInfo;
                proc.Start();
                // Get the output into a string
                string result = proc.StandardOutput.ReadToEnd();
                // Display the command output.
                return result;
            }
            catch (Exception objException)
            {
                // Log the exception
                return "";
            }
        }
    }
}
还是楼主强大。。。。。。等我去试一试:》
moonwrite 2014-05-05
  • 打赏
  • 举报
回复
Google一下,你就知道
threenewbee 2014-05-05
  • 打赏
  • 举报
回复
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = ExecuteCommandSync("ipconfig");
            Console.WriteLine(s);
        }
        static string ExecuteCommandSync(object command)
        {
            try
            {
                // create the ProcessStartInfo using "cmd" as the program to be run,
                // and "/c " as the parameters.
                // Incidentally, /c tells cmd that we want it to execute the command that follows,
                // and then exit.
                System.Diagnostics.ProcessStartInfo procStartInfo =
                    new System.Diagnostics.ProcessStartInfo("cmd", "/c " + command);

                // The following commands are needed to redirect the standard output.
                // This means that it will be redirected to the Process.StandardOutput StreamReader.
                procStartInfo.RedirectStandardOutput = true;
                procStartInfo.UseShellExecute = false;
                // Do not create the black window.
                procStartInfo.CreateNoWindow = true;
                // Now we create a process, assign its ProcessStartInfo and start it
                System.Diagnostics.Process proc = new System.Diagnostics.Process();
                proc.StartInfo = procStartInfo;
                proc.Start();
                // Get the output into a string
                string result = proc.StandardOutput.ReadToEnd();
                // Display the command output.
                return result;
            }
            catch (Exception objException)
            {
                // Log the exception
                return "";
            }
        }
    }
}
Meet03 2014-05-05
  • 打赏
  • 举报
回复
引用 3 楼 photel123456 的回复:
Dim here As IPHostEntry = Dns.GetHostEntry(Dns.GetHostName())可以获得IP。其它的你可以类推。
您好,这个基本上都找出来了,但是找不到那张卡是虚拟的,那张是物理卡啊?不好意思顺便问一下,怎么修改
Meet03 2014-05-05
  • 打赏
  • 举报
回复
您好,这个基本上都找出来了,但是找不到那张卡是虚拟的,那张是物理卡啊?不好意思顺便问一下,怎么修改
lliai 2014-05-05
  • 打赏
  • 举报
回复
Dim here As IPHostEntry = Dns.GetHostEntry(Dns.GetHostName())可以获得IP。其它的你可以类推。
Meet03 2014-05-05
  • 打赏
  • 举报
回复
G过,没有G出来。。。。都不是。。。

16,554

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧