Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to modify ip by bat

2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly shows you "bat how to achieve the modification of ip", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "bat how to achieve the modification of ip" this article.

The effect is shown in the following figure:

The code is as follows:

The code is as follows:

@ Echo Off

TITLE ip setter

: start

CLS

COLOR 2f

: use the COLOR command to change the console output color

Mode con cols=56 lines=20

:: MODE statement sets the width and height of the form

: sc_main

Echo

Echo.&echo.

Echo 0.192.168.0.99 & echo.

Echo 1.192.168.1.99 & echo.

Echo q. Quit & echo.&echo.&echo.&echo.&echo.&echo.

Set "select="

Set/p select= enter a number and press enter to continue:

If "% select%" = = "0" (goto sc_ip0)

If "% select%" = = "1" (goto sc_ip1)

If "% select%" = = "Q" (goto sc_exit)

: sc_exit

Exit

Goto: eof

: sc_ip0

Cls

Echo is being set up, please wait a moment

Netsh interface IP Set Address "Local connection" Static 192.168.0.99 255.255.255.0 192.168.0.1 1

Netsh interface IP set dns "Local connection" static 192.168.0.1 primary

Echo set up successfully 192.168.0.99

PAUSE > nul

Goto sc_main

: sc_ip1

Cls

Echo is being set up, please wait a moment

Netsh interface IP Set Address Local connection Static 192.168.1.99 255.255.255.0 192.168.1.1 1

Netsh interface IP set dns "Local connection" static 192.168.1.1 primary

Echo set up successfully 192.168.1.99

PAUSE > nul

Goto sc_main

The function of setting ip is realized through the netsh command line. Specific usage can be seen in cmd.

Netsh interface IP Set Address Local connection Static 192.168.1.99 255.255.255.0 192.168.1.1 1

Netsh interface IP set dns "Local connection" static 192.168.1.1 primary

The first line is to set the ip subnet mask gateway for ip

The second line sets the ip of dns. If you know the dns ip of the public network, you don't have to set this. The first line is fine.

In general, the dns is set to the gateway ip.

The above is all the contents of the article "how to modify ip by bat". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report