vb 怎么做计算机配置,用VB.NET实现设置计算机IP地址

用VB.NET实现设置计算机IP地址

2018-09-13

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

免责声明:本文仅代表文章作者的个人观点,与本站无关。其原创性、真实性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容文字的真实性、完整性和原创性本站不作任何保证或承诺,请读者仅作参考,并自行核实相关内容。

http://www.pinlue.com/style/images/nopic.gif

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值