Get the App
SLTechnology News&Howtos  ›  Development  › 

How to realize the BAT execution script of automatically changing the native IP address with one click

Shulou Source: shulou.com Published: 2022-06-03 08:23:20 11月15日 Update

This article is about how to implement a BAT execution script that automatically changes the native IP address with one click. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Please copy the following script, save it as .bat file, and modify the subnet mask, gateway, IP,DNS and other information into yours.

The following code has limitations: in fact, you can only set 192.168.1.* (2-254). If your ip is something else, you need to modify it and replace 192.168.1.1 with your gateway.

The code is as follows:

Cd\

Cls

@ echo off

Color a

: start

Set / p myip= "Please enter the IP assigned by the administrator:"

Cls

Echo, your IP address is% myip%

Pause

Color f

Cls

Echo is modifying your IP address, if there is a firewall pop-up, please set the permission to execute, please wait a moment.

Netsh interface ip set address name= "Local connection" source=static addr=%myip% mask=255.255.255.0

Cls

Echo is configuring your gateway, if there is a firewall pop-up, please set to allow execution, please wait a moment.

Netsh interface ip set address name= "Local connection" gateway=192.168.1.1 gwmetric=1

Cls

Echo is configuring your DNS. If there is a firewall pop-up, please set it to allow execution. Please wait a moment.

Netsh interface ip set dns name= "Local connection" source=static addr=192.168.1.1 register=PRIMARY

Cls

Echo is configuring your WINS. If there is a firewall pop-up, please set it to allow execution. Please wait a moment.

Netsh interface ip set wins name= "Local connection" source=static addr=none

Cls

Echo is updating your DNS, please wait a moment.

Ipconfig/flushdns

Thank you for reading! On "how to automatically change the local IP address of the BAT execution script" this article is shared here, I hope the above content can be of some help to you, so that you can learn more knowledge, if you think the article is good, you can share it out for more people to see it!

Tags: Address firewall fire prevention script code gateway configuration one button local content more articles facets good practical information limitations files articles Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft MariaDB macOS OPPO Reno Xiaomi