zoukankan      html  css  js  c++  java
  • C# 调用DOS 命令

      class NetWorkDeviceInfo

        {

            public static string GetDeviceInfo()

            {

                System.Diagnostics.Process p = new System.Diagnostics.Process();

                p.StartInfo.FileName = "netsh.exe";

                p.StartInfo.Arguments = "wlan show interfaces";

                p.StartInfo.UseShellExecute = false;

                p.StartInfo.RedirectStandardOutput = true;

                p.Start();

                string s = p.StandardOutput.ReadToEnd();

                Console.WriteLine(s);

                string s1 = s.Substring(s.IndexOf("SSID"));

                s1 = s1.Substring(s1.IndexOf(":"));

                s1 = s1.Substring(2, s1.IndexOf(" ")).Trim();

                if (s.IndexOf("Signal") > 0)

                {

                    string s2 = s.Substring(s.IndexOf("Signal"));

                    s2 = s2.Substring(s2.IndexOf(":"));

                    s2 = s2.Substring(2, s2.IndexOf(" ")).Trim();

                    var Text = "WIFI connected to " + s1 + "  " + s2;

                }

                p.WaitForExit();

                return s;

            }

        }

  • 相关阅读:
    C#获取屏幕鼠标所指点的颜色
    C#连接SQLServer数据库基本实现
    论文摘要写法
    红黑树
    递归、迭代和分治法
    逻辑右/左移与算术右/左移
    C 中数字数据类型在不同机器上所占字节数
    十进制转十六进制
    c带头结点的单链表逆置
    求一维数组长度误区
  • 原文地址:https://www.cnblogs.com/bruce1992/p/14885804.html
Copyright © 2011-2022 走看看