Board logo

标题: [系统相关] 一键把固定ip改成自动获取的bat脚本 [打印本页]

作者: qq544935474    时间: 2023-12-12 21:46     标题: 一键把固定ip改成自动获取的bat脚本

就是电脑是固定ip。现在需要改成自动获取,一个一个去改太麻烦,有没有bat可以一键修改的呢。
作者: ShowCode    时间: 2023-12-12 22:24

回复 1# qq544935474


试试类似的代码
http://bbs.bathome.net/thread-35672-1-1.html
http://bbs.bathome.net/thread-34382-1-1.html
作者: /zhqsystem/zhq    时间: 2023-12-12 22:34

  1. :Netsh_Interface_Show_Interface
  2. set "Netsh_N="&&for /f "skip=3 tokens=1-3,* delims= " %%w in ('"Netsh.exe Interface Show Interface"')do set/a "Netsh_N+=1"&&for /f %%n in ('"call echo,%%Netsh_N%%"')do set "Netsh_Connect_%%n=%%w %%x %%y %%z"
  3. for /f "tokens=1,* delims==" %%i in ('set Netsh_Connect_')do for /f "tokens=1-3,* delims= " %%w in ("%%j")do (
  4.   Netsh.exe interface Ip Set Address Name="%%z" Source=dhcp
  5.   Netsh.exe interface Ip Set DnsServers Name="%%z" Source=dhcp
  6. )
  7. goto:eof
复制代码





欢迎光临 批处理之家 (http://bbs.bathome.net/) Powered by Discuz! 7.2