打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

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

 
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
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
总结C#启动外部程序的几种方法
C#调用7z实现文件的压缩与解压
C#程序调用cmd执行命令
Cmd重定向
C# 调用命令行执行Cmd命令的操作
C# 制作Java +Mysql+Tomcat 环境安装程序,一键式安装
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服