zoukankan      html  css  js  c++  java
  • C#-宽带连接

            public static string Connect(string UserS,string PwdS)
            {
                string arg = @"rasdial.exe 宽带连接" + " " + UserS + " " + PwdS;
                return InvokeCmd(arg);
            }
    
    
            public static string Disconnect()
            {
                string arg = string.Format("rasdial "{0}" /disconnect", "宽带连接");
                return InvokeCmd(arg);
            }
    
    
            private static string InvokeCmd(string cmdArgs)
            {
                string Tstr = "";
                Process p = new Process();
                p.StartInfo.FileName = "cmd.exe";
                p.StartInfo.UseShellExecute = false;
                p.StartInfo.RedirectStandardInput = true;
                p.StartInfo.RedirectStandardOutput = true;
                p.StartInfo.RedirectStandardError = true;
                p.StartInfo.CreateNoWindow = true;
                p.Start();
    
    
                p.StandardInput.WriteLine(cmdArgs);
                p.StandardInput.WriteLine("exit");
                Tstr = p.StandardOutput.ReadToEnd();
                p.WaitForExit();
                p.Close();
                return Tstr;
            }

  • 相关阅读:
    构建之法读书笔记04
    团队冲刺06
    12.23——周总
    团队冲刺05
    团队冲刺04
    用户场景分析
    团队冲刺03
    返回一个二维数组中最大联通子数组的和
    团队冲刺02
    FFT/NTT基础题总结
  • 原文地址:https://www.cnblogs.com/csnd/p/12062180.html
Copyright © 2011-2022 走看看