Computer name DNS gateway IP (you can use to learn) _dos/bat

Source: Internet
Author: User
Tags dns2 generator goto
@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 network engraving server configuration
Echo.
Echo 3. Telecom netcom line switch generator
Echo.
Echo 4. Exit script
Echo.
echo Please enter 1,2,3 or 4, enter other characters, the consequences are 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 prompted according to different use situations
echo Input Ip,dns (supports up to two DNS), Gateway, COMPUTE
echo machine name. Scripting features that generate configuration-related information.
Echo-------------------------------------------------------
: Restart5
Color 0a
Echo.
echo Please enter 1 or 2, enter other characters, the consequences are 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 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 starts generating configuration computer name, gateway, DNS,IP,IPX Protocol Internal Network number script, 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:%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 note the following prompts, follow the prompts to complete the relevant information changes. Otherwise, hitting enter directly 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= Please enter the last field of the gateway, such as 254 in 192.168.0.254:
Color 71
set/p submask1= Please enter the subnet mask in the format 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 a second DNS address:
Color FC
ECHO is generating configuration scripts

echo @echo Off>%systemroot%\ipconfig.bat
Echo Cls>>%systemroot%\ipconfig.bat
Echo Echo--------------------------------------------------------->>%systemroot%\ipconfig.bat
echo Echo qq:66596854 Welcome AC >>%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 implement automatic configuration of Ip,>>%systemroot%\ipconfig.bat as needed
echo Echo DNS, Gateway, computer name, supports up to two Dns>>%systemroot%\ipconfig.bat
The Echo Echo Batch startup password is Wuliaodefei and can be based on the >>%systemroot%\ipconfig.bat
Echo Echo needs to modify the variable PW to change the startup password. Modify the appropriate >>%systemroot%\ipconfig.bat
echo Echo's own DNS, gateway, computer name. can see batch >>%systemroot%\ipconfig.bat
Echo Echo handles the place of the relevant annotation, at the end of the batch >>%systemroot%\ipconfig.bat
Echo Echo can also continue to add commands to achieve more functionality, >>%systemroot%\ipconfig.bat
Echo Echo for example, import CS Cd-key, automatically install freezing point and so on. >>%systemroot%\ipconfig.bat
Echo Echo------------------------------------------------------->>%systemroot%\ipconfig.bat
Echo Set sz=3 >>%systemroot%\ipconfig.bat
Echo:p W>>%systemroot%\ipconfig.bat
echo set/p pw= Please enter 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%% chance >>%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
Echo Echo welcomes the use of >>%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/a Ip=%%ip%%-0>>%systemroot%\ipconfig.bat
echo if%%ip%% LSS goto 1to9 >>%systemroot%\ipconfig.bat
echo if%%ip%% LSS goto 10to99>>%systemroot%\ipconfig.bat
echo if%%ip%% LSS 255 goto 100to254>>%systemroot%\ipconfig.bat
echo if%%ip%% geq 255 goto Error1>>%systemroot%\ipconfig.bat
Echo:1to9>>%systemroot%\ipconfig.bat
Echo Set A=00>>%systemroot%\ipconfig.bat
Echo Goto Ipconfig>>%systemroot%\ipconfig.bat

Echo:10to99>>%systemroot%\ipconfig.bat
Echo Set A=00>>%systemroot%\ipconfig.bat
Echo set/a 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 name you set is:%qz%%%a%%%%ip%% IP address:%ipaddr%%%ip%% Gateway:%ipaddr%%mask1%>>%systemroot%\ipconfig.bat
Echo Echo begins 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"/reg_sz/d%qz%%%a%%%%ip%%/F ^&G T;nul>>%systemroot%\ipconfig.bat
echo Echo Computer name configuration complete >>%systemroot%\ipconfig.bat
Echo set/a Ip=%%ip%%-0>>%systemroot%\ipconfig.bat
echo Echo begins configuring IP, Gateway >>%systemroot%\ipconfig.bat
echo Color 2a >>%systemroot%\ipconfig.bat
echo netsh interface ip set address "Local Area Connection" Source=static%ipaddr%%%ip%%%submask1%%ipaddr%%mask1% 1 ^>nul>>%syst Emroot%\ipconfig.bat
echo Echo IP configuration complete >>%systemroot%\ipconfig.bat
echo Echo starts configuration Dns>>%systemroot%\ipconfig.bat
echo netsh interface ip set DNS name= "Local Area Connection" Source=static%dns1% primary ^>nul>>%systemroot%\ipconfig.bat
echo netsh interface ip add DNS name= "Local Area Connection"%dns2% ^>nul>>%systemroot%\ipconfig.bat
echo Echo DNS configuration complete >>%systemroot%\ipconfig.bat
Echo Echo begins 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 complete >>%systemroot%\ipconfig.bat
echo Echo Deletes registry from startup entry >>%systemroot%\ipconfig.bat
echo reg delete hklm\software\microsoft\windows\currentversion\run/f/V computerconfigscript >>%systemroot%/ Ipconfig.bat
Echo Echo Delete Registry startup Project complete >>%systemroot%\ipconfig.bat

The Echo echo system will automatically reboot after 30 seconds, enter N to cancel the reboot, and manually reboot 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 you have entered an IP violation of the IP address usage rules, be sure to enter the number between 1--254 if necessary >>%systemroot%\ipconfig.bat
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 19 evening edition >>%systemroot%\ipconfig.bat
Echo Exit>>%systemroot%\ipconfig.bat
echo Configuration script Generation complete
Echo is setting the registry self-startup script
REG ADD hklm\software\microsoft\windows\currentversion\run/f/V computerconfigscript/t reg_sz/d%systemroot%\ Ipconfig.bat >nul
Echo Registry Startup Project Add complete
echo 10 seconds after the program automatically quits or directly closes the program exit
ping/n 127.0.0.1 >nul
Exit

: Errorselect5
echo Selection error, please select again
Goto RESTART5
: Errorselect1
echo Selection error, please select again
Goto RESTART1

: Netghost
Color 0a
Cls
Echo--------------------------------------------------------
Echo.
Echo Description
echo This batch can set the ghost server as required
echo-related information and automatically invoke the Ghostserver program
echo for ease of setup. This batch only supports single NIC, net
The Echo property name is local Area connection. otherwise this batch
echo does not apply or does not achieve the desired effect. This script is
Echo Live-use version, that is, the current setting runs only for scripts
Echo works and the script runs abnormally when it exits
Echo does not have the desired effect, thank you for using
Echo-------------------------------------------------------
Echo.
echo 1. Go to setup Ghost Server
Echo.
echo 2. Auto Restore previous settings
Echo.
Echo 3. Return to main Menu
Echo.
echo Please enter 1,2 or 3, enter other characters, the consequences are 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 you want to use for your current Ghost server:
set/p mask1= Please enter the subnet mask you want to use for the current Ghost server:
echo @echo off >%systemroot%\netghost.bat
Echo Echo backs up the current network settings >>%systemroot%\netghost.bat
Echo Ipconfig/all ^>%systemroot%\ipconfigbackup.txt>>%systemroot%\netghost.bat
echo Echo Current network setup backup complete >>%systemroot%\netghost.bat
echo Echo clears current DNS, gateway settings >>%systemroot%\netghost.bat
echo netsh interface ip delete address "Local Area Connection" Gateway=all ^>nul >>%systemroot%\netghost.bat
echo netsh interface ip delete DNS "Local Area Connection" all ^>nul >>%systemroot%\netghost.bat
Echo Echo configures the current network settings >>%systemroot%\netghost.bat
echo netsh interface ip set address "Local Area Connection" Source=static%ip1%%mask1% ^>nul >>%systemroot%\netghost.bat
echo Echo Current network setup complete >>%systemroot%\netghost.bat
Echo Echo starts ghost service-side 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 Area Connection" Source=static%ipaddr%%sub%%gate% 1 ^>nul >>%systemroot%\restore.bat
echo netsh interface ip set DNS name= "Local Area Connection" Source=static%dns1% primary ^>nul >>%systemroot%\restore.bat
echo netsh interface ip add DNS name= "Local Area Connection"%dns2% ^>nul >>%systemroot%\restore.bat
echo Echo Recovery Complete >>%systemroot%\restore.bat
Echo del%%systemroot%%\restore.bat >>%systemroot%\restore.bat
Echo Exit >>%systemroot%\restore.bat
%systemroot%\restore.bat
Exit
: Errorselect
echo Selection error, please select again
Goto restart
:d Ianxin
Color 0a
Cls
Echo-------------------------------------------------------
Echo.
Echo Description
echo This batch can be set up as required for telecommunications and network
The line switch between Echo pass. This batch only supports single No
Echo Network property name is "Local Area Connection". Then this
The echo batch does not apply or does not achieve the desired effect.
echo This script is a live use version, that is, the current setting only
Echo works on script, script runs abnormally
Echo exit can not achieve the desired effect, thank you for using
Echo-------------------------------------------------------
Echo.
echo Please enter 1 or 2, enter other characters, the consequences are at your own risk.
Echo.
Echo 1. Enter telecom netcom line switch generator
Echo.
Echo 2. Return to 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 the gateway, in the network properties see the gateway address discrepancies, but does not affect the use of this time in the network properties to see the gateway, does not play any role, but do not do any operation.
Echo.
set/p gateway1= Please enter the gateway you want to switch:
set/p dns1= Please enter the DNS address to switch:
echo @echo off >gatewaychange.bat
echo Echo Toggle, please wait a moment. >>gatewaychange.bat
echo netsh interface ip delete DNS "Local Area Connection" all ^>nul >>gatewaychange.bat
echo netsh interface ip set DNS name= "Local Area 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 here This script is implemented to generate a script file that switches the telecom and Netcom lines. Just the build script file does not run automatically, making it easy for a friend to use a script file and then handle the generated script file itself.
REM Removes the REM characters from the following 2 lines to enable Instant line switching (automatically runs the generated script after entering the relevant information, without having to run the generated script again to complete the line switch)
rem echo del gatewaychange.bat >>gatewaychange.bat
REM Gatewaychange.bat
Exit
: Errorselect3
echo Selection error, please select again
Goto RESTART2


: EndEnd
Exit
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.