Script that releases and renew a ip address with a script.
Posted on 2007-12-06
I got this script from EE> which can release and renew ip address once run.
What my issue is.
In remote locations when its required to change the ip address after reserving the ip in the DHCP.I need to release and renew it.
After a release when connected online i cannot connect to renew.So i need a script that can first release and then renew it.
:: IPREPAIR.CMD - Attempt to repair the network connections
:: Written 12/16/03 by Rick Campbell
:: Determine what OS this script is running on.
if not "%OS%"=="Windows_NT" goto :end
ver | find "[Version 5" || goto :end
:: Clear environment variables
:: Determine if client is dynamically or statically assigned an IP address
echo Determining if client is DHCP based...
for /f "tokens=3 delims= " %%d in (
''netsh int ip sh add ^| find /i "DHCP"''
) do (
:: If client is dynamic, then release and renew the IP address
if /i "%dhcp%"=="Yes" (
echo Client is using DHCP - Renewing the DHCP Address lease...
ipconfig /release > nul
ipconfig /renew > nul
) else (
echo Client is statically assigned - leaving address untouched...
:: Flush the ARP, NetBIOS, and DNS cache''s
echo Flushing the ARP Cache...
arp -d * > nul
echo Flushing the NetBIOS Cache...
nbtstat -R > nul
echo Flushing the DNS Cache...
ipconfig /flushdns > nul
:: Re-register the NetBIOS and Computer names with WINS and DNS
echo Re-registering the NetBIOS and Computer name with WINS and DNS...
nbtstat -RR > nul
ipconfig /registerdns > nul
echo This script is to be run on Windows 2000/XP/2003 Only!
Can you help checking if this script is right.