@ Echo off
Mode con Cols = 55 lines = 18
Rem setting public variables
Set net_interface = "Local Connection"
: Choice
Color
CLS
Echo ************** ******
Echo ---- [ipsettings] ------------- [system functions ]----------
Echo ----- 1. Modify IP-----------4 for local connection. Change to auto get -----
Echo ----- 2. Modify "local connection 1" ip ---------- R. Restart Nic -----------
Echo ----- 3. Modify the local connection to HOME_IP------X. Exit program -----------
Echo.
Echo ******************** tools by wlh *************** *******
Echo. Note that "local connection 1" is the connection name of the Network Neighbor !!!
: Mu
Set/P choice = enter your choice:
If not "% choice %" = "" set choice = % choice :~ 0, 1%
If/I "% choice %" = "1" Goto home‑ip
If/I "% choice %" = "2" Goto home2_ip
If/I "% choice %" = "3" Goto home3_ip
If/I "% choice %" = "4" Goto DHCP
If/I "% choice %" = "R" Goto reboot
If/I "% choice %" = "X" Goto end
Echo.
Echo.
Incorrect echo input. Please try again!
Echo.
Echo.
Goto choice
Pause
: Home‑ip
CLS
Echo.
ECHO is setting an IP address for the local connection. Please wait...
Echo.
Echo setting IP...
Set net_interface = "Local Connection"
: Choice1
Set/P IP1 = enter the last IP address segment:
If not "% IP1 %" = "" set/P yes1 = Are you sure the IP address is correct (enter 1 and press enter to confirm )? :
If "% yes1 %" = "" set yes1 = "1"
If not "% yes1 %" = "" set yes1 = % yes1 :~ 0, 1%
If/I "% yes1 %" = "1" Goto ip111
If/I "% yes1 %" = 1 goto ip111
Goto choice1
: Ip111
CLS
Netsh interface IP Set address "% net_interface %" Source = static ADDR = 192.168.1.% IP1 % mask = 255.255.255.0
Echo successfully set IP... Set gateway...
Netsh interface IP Set address name = "% net_interface %" Gateway = 192.168.1.1 gwmetric = 1
Echo settings are complete.
Ipconfig
Set/P Q1 = press 0 to exit
If not "% Q1 %" = "0" Goto choice
Goto choice8
: Home2_ip
CLS
Echo.
ECHO is setting IP address for local connection 1. Please wait...
Echo.
Echo setting IP...
Set net_interface = "local connection 1"
: Choice2
Set/P ip2 = enter the last IP address segment:
If not "% ip2 %" = "" set/P YES2 = Are you sure the IP address is correct (enter 1 and press enter to confirm )? :
If "% YES2 %" = "" set YES2 = "1"
If not "% YES2 %" = "" set YES2 = % YES2 :~ 0, 1%
If/I "% YES2 %" = "1" Goto ip222
Goto choice2
: Ip222
CLS
Netsh interface IP Set address "% net_interface %" Source = static ADDR = 192.168.1.% ip2 % mask = 255.255.255.0
Echo successfully set IP... Set gateway...
Netsh interface IP Set address name = "% net_interface %" Gateway = 192.168.1.1 gwmetric = 1
Echo settings are complete.
Ipconfig
Set/P q2 = press 0 to exit
If not "% Q2 %" = "0" Goto choice
Goto choice8
: Home3_ip
CLS
Echo.
ECHO is setting IP to home_ip. Please wait...
Echo.
Set net_interface = "Local Connection"
Echo setting IP...
Netsh interface IP Set address "% net_interface %" Source = static ADDR = 192.168.1.111 mask = 255.255.255.0
Echo successfully set IP... Set gateway...
Netsh interface IP Set address name = "% net_interface %" Gateway = 192.168.1.1 gwmetric = 1
Echo gateway is successfully set... DNS is set...
Netsh interface IP Set DNS "% net_interface %" static 218.85.152.99
Netsh interface IP add DNS "% net_interface %" 218.85.157.99 Index = 2
Pause | when the echo task is completed, press any key to return to the selection menu.
Goto choice8
: DHCP
Echo.
ECHO is setting the IP address to be automatically obtained. Please wait...
Echo.
Echo setting IP...
Netsh interface IP Set address name = "% net_interface %" Source = DHCP
Echo gateway is successfully set... DNS is set...
Netsh interface IP Set DNS "% net_interface %" Source = DHCP
Pause | when the echo task is completed, press any key to return to the selection menu.
Goto choice8
: Reboot
Echo restarting Nic... please wait...
Netsh interface set interface "% net_interface %" Disabled
Netsh interface set interface "% net_interface %" enable
Pause | when the echo task is completed, press any key to return to the selection menu.
Goto choice
: Choice8
: End
Exit