一台计算机开机时运行的bat文件内容如下
netsh interface ip delete address 本地连接 gateway=all
netsh interface ip add address 本地连接 gateway=192.168.0.253 gwmetric=1
netsh interface ip delete dns 本地连接 all
netsh interface ip add dns 本地连接 202.99.192.68
netsh interface ip add dns 本地连接 202.99.192.66 index=2
作用就是双线上网,切换线路我现在想用VB实现,应该怎样弄啊,大家给指点一下.

解决方案 »

  1.   

    直接在控制面的“計劃任務”下加命令不是好過了麼?編程應該這樣寫的
    Shell "cmd  c:\aaa.bat"
      

  2.   

    Shell "c:\COMMAND.COM " & App.Path & IIf(Len(App.Path) = 3, "abc.bat", "\abc.bat"), vbMaximizedFocus
      

  3.   

    用shell我能弄,我想的是不用shell可不可以啊?编程实现更改这些设置
      

  4.   

    netsh是系统命令啊,你VB编程实现也就是SHELL和SHELLEXECUTE来执行,何必绕远呢?
      

  5.   

    ^_^,还是shell
    Private Sub Command1_Click()
        Shell "netsh interface ip delete address ±¾µØÁ¬½Ó gateway=all", vbHide
        Shell "netsh interface ip add address ±¾µØÁ¬½Ó gateway=192.168.0.253 gwmetric=1", vbHide
        Shell "netsh interface ip delete dns ±¾µØÁ¬½Ó all", vbHide
        Shell "netsh interface ip add dns ±¾µØÁ¬½Ó 202.99.192.68", vbHide
        Shell "netsh interface ip add dns ±¾µØÁ¬½Ó 202.99.192.66 index=2", vbHide
    End Sub
      

  6.   

    Private Sub Command1_Click()
        Shell "netsh interface ip delete address 本地连接 gateway=all", vbHide
        Shell "netsh interface ip add address 本地连接 gateway=192.168.0.253 gwmetric=1", vbHide
        Shell "netsh interface ip delete dns 本地连接 all", vbHide
        Shell "netsh interface ip add dns 本地连接 202.99.192.68", vbHide
        Shell "netsh interface ip add dns 本地连接 202.99.192.66 index=2", vbHide
    End Sub
      

  7.   

    这个工具能自动获取你机器里都有哪些网络连接:
    http://www.powerbasic.cn/products/AutoShutdown.rar