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;

            }

        }

  • 相关阅读:
    CSS3 实现六边形Div图片展示效果
    自己编写jQuery插件 之 放大镜
    自己编写jQuery插件 之 无缝滚动
    C#装箱拆箱
    C#基础知识
    数据库锁
    SQL2008中Merge的用法
    SQl去获取相同记录
    判断DataRow中是否包含某列
    Quartz中时间表达式的设置-----corn表达式
  • 原文地址:https://www.cnblogs.com/bruce1992/p/14885804.html
Copyright © 2011-2022 走看看