2015-06-04 30 views

回答

0

我昨晚創建了這個,所有的一切似乎都按照它的方式工作。

@echo off 

: Disable Static IP/Enable DHCP Remove DNS  Enable NICs 
for /f "skip=2 tokens=3*" %%i in ('netsh interface show interface') do (
netsh int ip set address "%%j" dhcp >nul 2>&1 
netsh int ip set dns "%%j" dhcp >nul 2>&1 
netsh interface set interface name="%%j" admin=enabled >nul 2>&1 
) 

如果您想進一步清除DNS緩存,請將其添加到下一行。

ipconfig /flushdns >nul 2>&1 
1

您可以使用此腳本創建批處理文件,該文件將您的IP從靜態更改爲DHCP。

enter code here @迴響 enter code here netsh接口的IPv4地址集名稱= 「無線網絡」 源= DHCP
enter code here @迴響 enter code here netsh接口的IPv4設置DNS名稱= 「無線網絡」 源= DHCP

+0

閱讀問題 - '不必指定接口名稱'。問題已被正確回答。 – Seaner992