C#-宽带连接
2023-09-11 14:14:00 时间
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;
}
相关文章
- C# 基础知识 (四).C#简介及托管代码
- C# 连接SQLServer数据库及登录验证知识
- C# WinForm窗体 控件Control 的 Invalidate、Update、Refresh的区别
- C#中的OLEDB连接2
- C# string byte[] Base64 常用互相转换
- Client使用c#和odp.net连接server oracle
- C#设计模式——观察者模式(Observer Pattern)
- C# 视频监控系列(3):客户端——连接服务器并预览
- C# ArcgisEngine开发中,对一个图层进行过滤,只显示符合条件的要素
- C#中数据库连接的几种方式
- C# Sql Server连接(增、删、改、查)
- C# WinForm程序的App.Config数据库连接配置文件
- C# Oracle 连接与修改
- C# Oracle、Sql Server连接(增、删、改、查)
- C# 实现客户端Socket断开后重新连接。
- (72)C#里怎么样调用WIN API的函数
- (37)C#里为什么会出现$符号?
- (16)C# TcpClient异步连接和接收数据的小例子
- C#如何调用DOS命令
- [C#]c#中数据的同步加锁机制 的几种方法
- Android开发 客户端与C#服务器的连接+OkHttp+SQL Server