哪位大虾帮我解决C#调用DOS命令实现上网拨号的程序
有两个按钮 连接和断开,两个文本框填写拨号的登录账号密码,点击连接,调用DOS命令实现网络连接
点击断开,网络断开
请哪位大虾帮我解决这个问题(要详细代码),谢谢!!!Process p = new Process();
p.StartInfo.WorkingDirectory = "c:\\";
p.StartInfo.FileName = @"cmd.exe";
p.StartInfo.Arguments = "DOS 命令";
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.Start();
string outpuut = p.StandardOutput.ReadToEnd();
p.WaitForExit();这段代码 有错误,请哪位大虾改正!!
有两个按钮 连接和断开,两个文本框填写拨号的登录账号密码,点击连接,调用DOS命令实现网络连接
点击断开,网络断开
请哪位大虾帮我解决这个问题(要详细代码),谢谢!!!Process p = new Process();
p.StartInfo.WorkingDirectory = "c:\\";
p.StartInfo.FileName = @"cmd.exe";
p.StartInfo.Arguments = "DOS 命令";
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.Start();
string outpuut = p.StandardOutput.ReadToEnd();
p.WaitForExit();这段代码 有错误,请哪位大虾改正!!
解决方案 »
- 一个Button调用一个类的实体对象,类方法为+=1 并显示
- 如何限制TreeView节点拖动时,只能在同级拖动呢?
- 求助 正则表达式 在线等(急)
- 发一个自己做的电子书
- datagridview中DataGridViewComboBox如何实现
- 急!无法加载 DLL“webengine.dll”: 找不到指定的模块。 (异常来自 HRESULT:0x8007007E)。
- ★★★100分求助关于DataGrid的单元格合并问题,有难度★★★
- c# 事件的含义究竟是什么(刚学习到委托与事件的菜鸟提问)
- 菜鸟提问。怎么根据控件的txt值改变就可以得到另外的控件的值
- 在combobox的textupdate事件响应里,如何把EventArgs变成一个有用的类型?
- C#问题
- 讨论一下最快的移动文件的方法
private void FrmMain_Load(object sender, EventArgs e)
{
arrCommand[0] = "rasdial " + m_strADSLName + " /disconnect";
arrCommand[1] = "rasdial " + m_strADSLName + " " + m_strADSLAcc + " " + m_strADSLPwd;
} private bool ReDial()
{
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;
string strOutput = null;
try
{
p.Start();
foreach (string item in arrCommand)
{
p.StandardInput.WriteLine(item);
}
p.StandardInput.WriteLine("exit");
strOutput = p.StandardOutput.ReadToEnd();
p.WaitForExit(); }
catch (Exception e)
{
strOutput = e.Message;
System.Threading.Thread.Sleep(1000);
return false;
}
finally
{
if (p != null)
p.Close();
} if (strOutput.IndexOf("选择“错误信息”") >= 0)
{
System.Threading.Thread.Sleep(1000);
return false;
}
return true;
}