系统切换成自动获取IP的方法

  系统切换成自动获取IP

  以下是代码片段:

  @echo off

  netsh interface ip set address name=“local” source=dhcp

  netsh interface ip set dns name=“local” source=dhcp

  “local” 是你的本地网卡名称,也可能是 “本地连接”,需要自己替换下。如果是2个固定IP间的来回切换,把第2个脚本自己改改吧 :)

  dns设置中,第一个是set,表示设置,后面两个则是添加,自己替换成当地的dns server。