windows - Remove Static IP & DNS on all Interfaces - Batch -
i need window's batch script remove static ip address (change dhcp), remove set dns, , enable network interfaces without having specify interface name; since interfaces may named differently.
i created last night, , seems work way should.
@echo off : disable static ip/enable dhcp remove dns enable nics /f "skip=2 tokens=3*" %%i in ('netsh interface show interface') ( 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 )
if want take step further , clear dns cache, add next line.
ipconfig /flushdns >nul 2>&1
Comments
Post a Comment