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 set the computer name DNS gateway IP

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly introduces the relevant knowledge of "how to set up the computer name DNS gateway IP". The editor shows you the operation process through the actual case, the operation method is simple, fast and practical. I hope this article "how to set up the computer name DNS gateway IP" can help you solve the problem.

@ echo off

: main

Cls

Echo.

Echo.

Echo 1. Generate automatic configuration computer name, DNS, gateway, IP script, IPX internal network number

Echo.

Echo 2. Automatic configuration of engraving server

Echo.

Echo 3. Telecom Netcom line switching generator

Echo.

Echo 4. Exit script

Echo.

Echo, please enter 1, 2, 3 or 4, enter other characters, at your own risk.

: restart1

Set / p select= please enter:

Set / a select=%select%-0

If select%==1 goto ipdnsipx

If select%==2 goto netghost

If select%==3 goto dianxin

If select%==4 goto endend

If select% gtr 4 goto errorselect1

: ipdnsipx

Cls

Echo

Echo.

Echo description

Echo this batch can be processed according to different uses according to the prompts

Echo input IP,DNS (up to two DNS), gateway, calculation

Echo machine name. A script function that generates configuration-related information.

Echo

: restart5

Color 0a

Echo.

Echo, please enter 1 or 2, enter other characters, at your own risk.

Echo.

Echo 1. Generate automatic configuration computer name, DNS, gateway, IP script, IPX internal network number

Echo.

Echo 2. Return to the main menu

Echo.

Set / p select= please enter:

Set / a select=%select%-0

If select%==1 goto config5

If select%==2 goto main

If select% gtr 2 goto errorselect5

: config5

Echo begins to generate scripts to configure the computer name, gateway, and DNS,IP,IPX protocol internal network number. Please enter the necessary parameters according to the prompts

Echo.

Set ipaddr=192.168.0.

Set mask1=254

Set submask1=255.255.255.0

Set qz=pc

Set dns1=61.177.7.1

Set dns2=192.168.0.254

The echo default computer name prefix is:% qz%,IP address the first three fields are:% ipaddr%, gateway is:% ipaddr%%mask1%, subnet mask is% submask1%, first DNS is% dns1%, second DNS is% DNS2%. If you need to modify the information here, please pay attention to the following tips and follow the prompts to complete the modification of the relevant information. Otherwise, directly hitting the enter key will use the default configuration.

Echo.

Set / p ipaddr= Please enter the first three fields of the IP address for example: 192.168.0. Be sure to enter in this format:

Color 70

Set / p mask1= enter the last field of the gateway, such as 254 in 192.168.0.254:

Color 71

Set / p submask1= enter the subnet mask in the format of 255.255.255.0:

Color 74

Set / p qz= Please enter the computer name prefix:

Color 72

Set / p dns1= Please enter the first DNS address:

Color 73

Set / p dns2= Please enter the second DNS address:

Color fc

Echo is generating a configuration script

Echo @ echo off >% systemroot%\ ipconfig.bat

Echo cls > >% systemroot%\ ipconfig.bat

Echo echo-- > >% systemroot%\ ipconfig.bat

Echo echo QQ:66596854 Welcome Exchange >% systemroot%\ ipconfig.bat

Echo echo Mail:fan2800@hotmail.com > >% systemroot%\ ipconfig.bat

Echo echo. >% systemroot%\ ipconfig.bat

Echo echo description > >% systemroot%\ ipconfig.bat

Echo echo this batch can automatically configure IP as needed, > >% systemroot%\ ipconfig.bat

Echo echo DNS, gateway, computer name. Up to two DNS > >% systemroot%\ ipconfig.bat are supported.

The echo echo batch startup password is wuliaodefei, which can be based on >% systemroot%\ ipconfig.bat

Echo echo needs to modify the variable PW to change the startup password. Modify > >% systemroot%\ ipconfig.bat

Echo echo corresponds to its own DNS, gateway and computer name. You can see batch > >% systemroot%\ ipconfig.bat

Comments related to echo echo processing, at the end of the batch > >% systemroot%\ ipconfig.bat

Echo echo can also continue to add commands to achieve more functions, > >% systemroot%\ ipconfig.bat

Echo echo for example, import CD-KEY of CS, automatically install freezing point, etc. > >% systemroot%\ ipconfig.bat

Echo echo-- > >% systemroot%\ ipconfig.bat

Echo set sz=3 > >% systemroot%\ ipconfig.bat

Echo: pw > >% systemroot%\ ipconfig.bat

Echo set / p pw= Please enter the password: > >% systemroot%\ ipconfig.bat

Echo set / a sz=%%sz%%-1 > >% systemroot%\ ipconfig.bat

Echo if pw%%==wuliaodefei goto config > > systemroot%\ ipconfig.bat

Echo echo password error, and% sz%% opportunity > >% systemroot%\ ipconfig.bat

Echo if sz%%==0 exit > > systemroot%\ ipconfig.bat

Echo color ca > >% systemroot%\ ipconfig.bat

Echo goto pw > >% systemroot%\ ipconfig.bat

Echo: config > >% systemroot%\ ipconfig.bat

Echo cls > >% systemroot%\ ipconfig.bat

Echo color 0A > >% systemroot%\ ipconfig.bat

Welcome to echo echo > >% systemroot%\ ipconfig.bat

Echo echo. >% systemroot%\ ipconfig.bat

Echo cls > >% systemroot%\ ipconfig.bat

Echo: ipconfigstart > >% systemroot%\ ipconfig.bat

Echo set ip=0 > >% systemroot%\ ipconfig.bat

Echo set / p ip= Please enter IP: > >% systemroot%\ ipconfig.bat

Echo if ip%%==0 goto errorip > > systemroot%\ ipconfig.bat

Echo set / an ip=%%ip%%-0 > >% systemroot%\ ipconfig.bat

Echo if ip%% lss 10 goto 1to9 > > systemroot%\ ipconfig.bat

Echo if ip%% lss 100 goto 10to99 > > systemroot%\ ipconfig.bat

Echo if ip%% lss 255goto 100to254 > > systemroot%\ ipconfig.bat

Echo if ip%% geq 255goto error1 > > systemroot%\ ipconfig.bat

Echo: 1to9 > >% systemroot%\ ipconfig.bat

Echo set axiom > >% systemroot%\ ipconfig.bat

Echo goto ipconfig > >% systemroot%\ ipconfig.bat

Echo: 10to99 > >% systemroot%\ ipconfig.bat

Echo set axiom > >% systemroot%\ ipconfig.bat

Echo set / an a=%%a%%-0 > >% systemroot%\ ipconfig.bat

Echo goto ipconfig > >% systemroot%\ ipconfig.bat

Echo: 100to254 > >% systemroot%\ ipconfig.bat

Echo set a = > >% systemroot%\ ipconfig.bat

Echo: ipconfig > >% systemroot%\ ipconfig.bat

Echo echo the computer you set up is named:% qz%%%a%%%%ip%% IP address:% ipaddr%%%ip%% Gateway:% ipaddr%%mask1% > >% systemroot%\ ipconfig.bat

Echo echo starts configuring computer name > >% systemroot%\ ipconfig.bat

Echo color 1a > >% systemroot%\ ipconfig.bat

Echo reg add HKLM\ system\ currentcontrolset\ control\ computername\ computername\ / v computername / t reg_sz / d% qz%%%a%%%%ip%% / f ^ > nul >% systemroot%\ ipconfig.bat

Echo reg add HKLM\ system\ currentcontrolset\ services\ tcpip\ Parameters\ / v "NV Hostname" / t reg_sz / d% qz%%%a%%%%ip%% / f ^ > nul > > systemroot%\ ipconfig.bat

Echo echo computer name configuration completed > >% systemroot%\ ipconfig.bat

Echo set / an ip=%%ip%%-0 > >% systemroot%\ ipconfig.bat

Echo echo starts to configure IP, gateway > >% systemroot%\ ipconfig.bat

Echo color 2a > >% systemroot%\ ipconfig.bat

Echo netsh interface ip set address Local connection source=static ipaddr%%%ip%% submask1% ipaddr%%mask1% 1 ^ > nul > systemroot%\ ipconfig.bat

Echo echo IP configuration complete > >% systemroot%\ ipconfig.bat

Echo echo starts configuring DNS > >% systemroot%\ ipconfig.bat

Echo netsh interface ip set dns name= Local connection source=static% dns1% primary ^ > nul > >% systemroot%\ ipconfig.bat

Echo netsh interface ip add dns name= Local connection% dns2% ^ > nul > >% systemroot%\ ipconfig.bat

Echo echo DNS configuration complete > >% systemroot%\ ipconfig.bat

Echo echo starts configuring IPX protocol internal network number > >% systemroot%\ ipconfig.bat

Echo color 3a > >% systemroot%\ ipconfig.bat

Echo reg add HKLM\ SYSTEM\ CurrentControlSet\ Services\ NwlnkIpx\ Parameters / f / v VirtualNetworkNumber / t REG_DWORD / d% ip%% > >% systemroot%\ ipconfig.bat

Echo echo IPX protocol internal network number configuration completed > >% systemroot%\ ipconfig.bat

Echo echo delete registry startup key >% systemroot%\ ipconfig.bat

Echo reg delete HKLM\ SOFTWARE\ Microsoft\ Windows\ CurrentVersion\ Run / f / v computerconfigscript > >% systemroot%/ipconfig.bat

Echo echo deletion of registry startup entry completed > >% systemroot%\ ipconfig.bat

The echo echo system will restart automatically after 30 seconds. Type N to cancel the restart and manually restart the computer later > >% systemroot%\ ipconfig.bat

Echo start% systemroot%%\ system32\ shutdown-r-t 30 > >% systemroot%\ ipconfig.bat

Echo set / p restart1= > >% systemroot%\ ipconfig.bat

Echo if% restart1%%==n start% systemroot%%\ system32\ shutdown-a > >% systemroot%\ ipconfig.bat

Echo goto end > >% systemroot%\ ipconfig.bat

Echo: error1 > >% systemroot%\ ipconfig.bat

Echo echo the IP you entered violates the rules for the use of IP addresses. Please be sure to enter the number between 1 systemroot% 254 > >% Muhami\ ipconfig.bat as needed.

Echo goto ipconfigstart > >% systemroot%\ ipconfig.bat

Echo: errorip > >% systemroot%\ ipconfig.bat

Echo echo you did not enter IP, please re-enter > >% systemroot%\ ipconfig.bat

Echo goto ipconfigstart > >% systemroot%\ ipconfig.bat

Echo color fc > >% systemroot%\ ipconfig.bat

Echo: end > >% systemroot%\ ipconfig.bat

Echo rem November 19th evening edition > >% systemroot%\ ipconfig.bat

Echo exit > >% systemroot%\ ipconfig.bat

Echo configuration script generated

Echo is setting up registry self-startup scripts

Reg add HKLM\ SOFTWARE\ Microsoft\ Windows\ CurrentVersion\ Run / f / v computerconfigscript / t REG_SZ / d% systemroot%\ ipconfig.bat > nul

Echo registry startup project addition completed

After 10 seconds of echo, the program automatically exits or directly closes the program to exit.

Ping / n 15 127.0.0.1 > nul

Exit

: errorselect5

Wrong choice of echo, please re-select

Goto restart5

: errorselect1

Wrong choice of echo, please re-select

Goto restart1

: netghost

Color 0a

Cls

Echo

Echo.

Echo description

Echo this batch can set the GHOST server's

Echo related information, and automatically call the GHOSTSERVER program

Echo to facilitate setup. This batch only supports single network card and network.

The name of the echo complex property is Local connection. Otherwise, this batch

Echo is not applicable or can not achieve the desired results. This script is

Echo Live version, that is, the current settings run only for scripts

It works in echo, and it can also be reached when the script exits abnormally.

Echo is not as good as expected. Thank you for using it.

Echo

Echo.

Echo 1. Enter the setup GHOST server

Echo.

Echo 2. Automatically restore previous settings

Echo.

Echo 3. Return to the main menu

Echo.

Echo, please enter 1 no 2 or 3, enter other characters, at your own risk.

: restart

Set / p select= please enter:

Set / a select=%select%-0

If select%==1 goto config1

If select%==2 goto config2

If select%==3 goto main

If select% gtr 3 goto errorselect

: config1

Set / p ip1= Please enter the IP address that the current GHOST server needs to use:

Set / p mask1= enter the subnet mask that the current GHOST server needs to use:

Echo @ echo off >% systemroot%\ netghost.bat

Echo echo backup current network settings > >% systemroot%\ netghost.bat

Echo ipconfig / all ^ >% systemroot%\ ipconfigbackup.txt > >% systemroot%\ netghost.bat

Echo echo current network settings backup completed > >% systemroot%\ netghost.bat

Echo echo clears current DNS, gateway settings > >% systemroot%\ netghost.bat

Echo netsh interface ip delete address Local connection gateway=all ^ > nul > >% systemroot%\ netghost.bat

Echo netsh interface ip delete dns Local connection all ^ > nul > >% systemroot%\ netghost.bat

Echo echo configuration current network settings > >% systemroot%\ netghost.bat

Echo netsh interface ip set address Local connection source=static% ip1%% mask1% ^ > nul > >% systemroot%\ netghost.bat

Echo echo current network setup completed > >% systemroot%\ netghost.bat

Echo echo starts the GHOST server program > >% systemroot%\ netghost.bat

Echo start ghostsrv83.exe > >% systemroot%\ netghost.bat

Echo del systemroot%%\ netghost.bat > > systemroot%\ netghost.bat

Echo exit > >% systemroot%\ netghost.bat

% systemroot%\ netghost.bat

Exit

: config2

Find / I "IP Address"% systemroot%\ ipconfigbackup.txt > ipaddr.txt

For / f "skip=2 tokens=15"% p in (ipaddr.txt) do set ipaddr=%%p

Find / I "Subnet Mask"% systemroot%\ ipconfigbackup.txt > subnetmask.txt

For / f "skip=2 tokens=15"% b in (subnetmask.txt) do set sub=%%b

Find / I "Default Gateway"% systemroot%\ ipconfigbackup.txt > gateway.txt

For / f "skip=2 tokens=13" g in (gateway.txt) do set gate=%%g

Find / I "DNS Servers"% systemroot%\ ipconfigbackup.txt > dnss.txt

For / f "skip=2 tokens=15" d in (dnss.txt) do set dns1=%%d

For / f% n in (% systemroot%\ ipconfigbackup.txt) do set dns2=%%n

Del ipaddr.txt

Del subnetmask.txt

Del gateway.txt

Del dnss.txt

Echo ipaddr% sub% gate% dns1% dns2%

Echo @ echo off >% systemroot%\ restore.bat

Echo echo recovery IP,DNS, subnet mask, gateway settings > >% systemroot%\ restore.bat

Echo netsh interface ip set address Local connection source=static ipaddr% sub% gate% 1 ^ > nul > systemroot%\ restore.bat

Echo netsh interface ip set dns name= Local connection source=static% dns1% primary ^ > nul > >% systemroot%\ restore.bat

Echo netsh interface ip add dns name= Local connection% dns2% ^ > nul > >% systemroot%\ restore.bat

Echo echo restore completed > >% systemroot%\ restore.bat

Echo del systemroot%%\ restore.bat > > systemroot%\ restore.bat

Echo exit > >% systemroot%\ restore.bat

% systemroot%\ restore.bat

Exit

: errorselect

Wrong choice of echo, please re-select

Goto restart

: dianxin

Color 0a

Cls

Echo

Echo.

Echo description

Echo this batch processing can be set up for telecom and network as required.

Line handover between echo connections. Only single no is supported in this batch

Echo network card, the network attribute name is "local connection". Then this

Echo batch processing is not applicable or does not achieve the desired results.

Echo this script is for live use, that is, the current settings are only

Echo plays a role in the running of the script, which is not normal.

Echo can not achieve the desired effect when it exits. Thank you for using.

Echo

Echo.

Echo, please enter 1 or 2, enter other characters, at your own risk.

Echo.

Echo 1. Enter the Telecom Netcom line handover generator

Echo.

Echo 2. Return to the main menu

Echo.

: restart2

Set / p select= please enter:

Set / a select=%select%-0

If select%==1 goto config3

If select%==2 goto main

If select% gtr 2 goto errorselect3

: config3

Echo special note: after using this script to switch gateways, you can see that there is a discrepancy in the gateway address in the network properties, but it does not affect the use. At this time, the gateway you see in the network properties does not work, but do not do anything.

Echo.

Set / p gateway1= Please enter the gateway to be switched:

Set / p dns1= Please enter the DNS address to switch:

Echo @ echo off > gatewaychange.bat

Echo echo switching, please wait a moment. > > gatewaychange.bat

Echo netsh interface ip delete dns Local connection all ^ > nul > > gatewaychange.bat

Echo netsh interface ip set dns name= Local connection source=static dns1% primary ^ > nul > gatewaychange.bat

Echo route delete 0.0.0.0 > > gatewaychange.bat

Echo route add 0.0.0.0 mask 0.0.0.0 gateway1% > > gatewaychange.bat

Rem to this script here to achieve, generate a script file for switching telecom and Netcom lines. Only the generated script file will not run automatically, so it is convenient for friends who only need the script file and then deal with the generated script file.

Rem deletes the rem characters in front of the following two lines to achieve instant line switching (after entering relevant information, the generated script will be run automatically, and there is no need to run the generated script again to complete the line switching)

Rem echo del gatewaychange.bat > > gatewaychange.bat

Rem gatewaychange.bat

Exit

: errorselect3

Wrong choice of echo, please re-select

Goto restart2

: endend

Exit

This is the end of the content about "how to set up the computer name DNS gateway IP". Thank you for your reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.

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