Wind7 Batch Set IP (script)
Description: Fill in your own IP address at the x.x.x.x.
Save as a ". bat" file and run as an administrator.
The code is as follows:
@echo off
: Main
Cls
echo please follow the instructions ...
Echo.
Echo 1 Sti-hust
Echo 2 dian-hust-711
Echo 3 DHCP
Echo 4 Exit
Echo.
set/p choice= Input A number:
Echo.
If "%choice%" = = "1" goto Ip_sti
If "%choice%" = = "2" goto ip_dian711
If "%choice%" = = "3" goto IP_DHCP
If "%choice%" = = "4" goto Ip_exit
Goto Main
: Ip_sti
echo IP Automatic setting ...
Echo.
echo updates IP and subnet masks
netsh interface ip set address name= "Local Area Connection" Source=static addr=x.x.x.x mask=x.x.x.x gateway=x.x.x.x gwmetric=1
echo Update DNS Server
netsh interface ip set DNS name= "Local Area Connection" Source=static addr=x.x.x.x register=primary
netsh interface ip add DNS name= "Local Area Connection" addr=x.x.x.x
echo Settings complete
Pause
Exit
if errorlevel 2 goto main
if errorlevel 1 goto end
: ip_dian711
echo IP Automatic setting ...
Echo.
echo updates IP and subnet masks
netsh interface ip set address name= "Local Area Connection" Source=static addr=x.x.x.x mask=x.x.x.x gateway=x.x.x.x gwmetric=1
echo Update DNS Server
netsh interface ip set DNS name= "Local Area Connection" Source=static addr=x.x.x.x register=primary
netsh interface ip add DNS name= "Local Area Connection" addr=x.x.x.x
echo Settings complete
Pause
Exit
if errorlevel 2 goto main
if errorlevel 1 goto end
: Ip_dhcp
netsh interface ip set address name= "Local Area Connection" Source=dhcp
netsh interface ip set DNS name= "Local Area Connection" Source=dhcp
netsh interface ip set wins name= "Local Area Connection" Source=dhcp
echo Settings complete
Pause
Exit
if errorlevel 2 goto main
if errorlevel 1 goto end
: Ip_exit
Exit