vb.net技术问题分享:用VB.NET实现设置计算机IP地址
vb.net吧
全部回复
仅看楼主
level 4
Private Sub Button_Click()
Dim p As 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("netsh interface ip set address " + " ""本地连接"" " + " static 192.168.0.108 255.255.255.0 192.168.0.1 1")
p.StandardInput.WriteLine("netsh -c interface ip set dns name=" + " ""本地连接"" " + " source=static addr=220.189.127.107 register=PRIMARY")
p.StandardInput.WriteLine("exit")
Dim strMessage As String = p.StandardOutput.ReadToEnd()
If (strMessage.IndexOf("确定") <> -1) Then
MessageBox.Show("填写ip成功!")
Else
MessageBox.Show("填写ip失败!!")
End If
p.Close()
End Sub
2015年08月21日 05点08分 1
level 13

2015年08月21日 22点08分 2
level 4
很久很久以前,天是蓝的,水是绿的,庄稼是种在田里的,肉还是放心吃的,老鼠还是怕猫的,法庭还是讲理的,银行还是敢存钱的,发廊还是只管剪头发的,照相还是穿着衣服的、人民大会堂还是坐着人民的,看帖还是要回帖的……
2015年08月22日 02点08分 3
1