最近老是换来换去,无奈windows固定IP,老要点那么几下,
想自己写个程序一下搞定,
谢谢了

解决方案 »

  1.   

    做过批处理好了把当前的IP设置保存到c:\ip.txt文件中
    netsh -c interface dump >c:\ip.txt导入c:\ip.txt文件中的网络设置
    netsh -f c:\ip.txt利用这个命令,先把两个IP设置导出,然后再做两个导入IP的批处理,
    切换IP的时候运行下批处理就行了
      

  2.   

    :snowlight81(落霜) 不错,
    但是难道就没这方面的API?
      

  3.   

    我都是用一个叫IPHelper的程序来切换IP地址的
      

  4.   

    @echo off
    @echo 正在切换到static IP.......netsh interface ip set address name="本地连接" source=static addr=x.x.x.x mask=255.255.255.0 gateway="x.x.x.x" gwmetric=1 
    netsh interface ip set dns name="本地连接" static x.x.x.x register=PRIMARY 保存成.bat, 拿去用吧