Windows using bat to quickly set the IP address of the batch code

  

@Save the following bat, you can use it. @echo off echo Configuring ip, please wait...

set name= "Local Connection"set ipaddress=1.2.3.4set mask=255.255.255.0set gateway=1.2.3.4set dns=1.2.3.4set wins=1.2.3.4

echo configuring %name%, please Wait a moment... echo is configuring preferred DNS: %dns%...netsh interface ip set dns name="local connection" source=static addr=%dns%echo configuring alternate DNS: %wins%... Netsh interface ip add dns "local connection" addr=%wins% index=2

echo configuring ip, mask, and gateway: %ipaddress% %mask% %gateway%...netsh interface ip set Address name=%name% source=static addr=%ipaddress% mask=%mask% gateway=%gateway%echo ip configuration succeeded!

echo. & pause with bat configuration win ip at dns stage Alarm: The configured DNS server does not exist or is incorrect. The solution is to put the DNS setting code before the ip address. The estimated reason is that the ip is set first, and the dns is blinded. If you have time, study it.

Copyright © Windows knowledge All Rights Reserved