Windows 7 batch processing automatically modifies the local IP address and wireless IP address. bat

Source: Internet
Author: User
Tags dns2
@ Echo off title alpha-IP address modification tool mode con: cols = 80 lines = 20rem IP address list set lname = Local Connection REM local connection IP address 1 company IP address set ladd1 = 192.168.3.126 set lmask1 = 255.255.252.0 set lgat1 = 192.168.3.254 set ldns11 = 202.96.199.20.set ldns12 = Beijing rem local connection IP address 2 home IP address set ladd2 = 192.168.0.115 set lmask2 = 255.255.255.0 set lgat2 = 192.168.0.1 set ldns21 = 202.96.199.20.set ldns22 = 202.106.196.115set wname = wireless network connection REM wireless connection IP Address Company IP address set wadd1 = % ladd1 % set wmask1 = % lmask1 % set wgat1 = % lgat1 % set wdns11 = % ldns11 % set wdns12 = % ldns12 % REM wireless connection IP address second home IP address set wadd2 = % ladd2 % set wmask2 = % lmask2 % set wgat2 = % lgat2 % set wdns21 = % ldns21 % set wdns22 = % ldns21 %: home CLS @ echo. @ echo alpha-IP address modification tool (kyt -- panfu) @ echo. @ Echo 1: Set % lname % @ Echo 2: Set % wname % @ echo. @ echo warning: In win7, you must right-click [run as Administrator (a)]! @ Echo. @ echo. set shut = "" set/P shut = "enter [<1> or <2> or <q> exit] and press Enter: "If not" % shut % "=" "(if % shut % NEQ" "set shut = % shut :~ 0, 1%) else (set shut = "") if/I % shut % = 1 goto locally if/I % shut % = 2 goto wireless if/I % shut % = Q exit goto home: locally CLS @ echo. @ echo modify % lname % IP address (kyt -- panfu) @ echo. @ Echo 1: Set % lname % to automatically obtain the IP address @ Echo 2: Set % lname % to the company IP address % ladd1 % @ Echo 3: set % lname % IP address to private IP % ladd2 % @ echo. @ echo. set shut = "" set/P shut = "enter [<1> or <2> or <3> or <q> exit] and press ENTER or press <enter key> to return main Menu: "If not" % shut % "=" "(if % Shut % NEQ "" set shut = % shut :~ 0, 1%) else (set shut = "") if/I % shut % = 1 goto locallyone if/I % shut % = 2 goto locallytwo if/I % shut % = 3 goto locallythree if/I % shut % = = Q exit goto home: wireless CLS @ echo. @ echo modify % wname % IP address (kyt -- panfu) @ echo. @ Echo 1: Set % wname % to automatically obtain the IP address @ Echo 2: Set % wname % to the company IP address % wadd1 % @ Echo 3: set % wname % IP address to private IP % wadd2 % @ echo. @ echo. set shut = "" set/P shut = "enter [<1> or <2> or <3> or <q> to exit] and press ENTER or <Enter key> return to the main menu: "If not" % shut % "=" "(if % shut % NEQ" "set shut = % shut :~ 0, 1%) else (set shut = "") if/I % shut % = 1 goto wirelessone if/I % shut % = 2 goto wirelesstwo if/I % shut % = 3 goto wirelessthree if/I % shut % = = Q exit goto homerem: locallyone @ echo. @ ECHO is setting % lname % IP address. Please wait... Call: autolocall % lname %> NUL @ echo setting % lname % automatic IP address acquisition successful !! @ Echo. @ echo. Goto three: locallytwo @ echo. @ ECHO is setting % lname % IP address. Please wait... Call: autowireless % wname %> nul cmd/C netsh interface IP Set address name = "% lname %" static % ladd1 % lmask1 % lgat1 %> nul cmd/C netsh interface IP add DNS name = "% lname %" % ldns11 % Index = 1> nul cmd/C netsh interface IP add DNS name = "% lname %" % ldns12 % Index = 2> NUL @ echo % lname % IP address set successfully !!! @ Echo. @ echo current IP Address: % ladd1 % @ echo current subnet mask: % lmask1 % @ echo current Default Gateway: % lgat1 % @ echo current dns1 address: % ldns11 % @ echo current dns2 address: % ldns12 % @ echo. @ echo. goto three: locallythree @ echo. @ ECHO is setting % lname % IP address. Please wait... Call: autowireless % wname %> nul cmd/C netsh interface IP Set address name = "% lname %" static % ladd2 % lmask2 % lgat2 %> nul cmd/C netsh interface IP add DNS name = "% lname %" ADDR = % ldns21 % Index = 1> nul cmd/C netsh interface IP add DNS name = "% lname %" ADDR = % ldns22 % Index = 2> NUL @ ECHO: % lname % IP address set successfully !!! @ Echo. @ echo current IP Address: % ladd2 % @ echo current subnet mask: % lmask2 % @ echo current Default Gateway: % lgat2 % @ echo current dns1 address: % ldns21 % @ echo current dns2 address: % ldns22 % @ echo. @ echo. goto three: set local network connection end: Set wireless network connection start: wirelessone @ echo. @ ECHO is setting % wname % IP address. Please wait... Call: autowireless % wname %> NUL @ echo setting % wname % automatic IP address acquisition successful !! @ Echo. @ echo. Goto three: wirelesstwo @ echo. @ ECHO is setting % wname % IP address. Please wait... Call: autolocall % lname %> nul cmd/C netsh interface IP Set address name = "% wname %" static % wadd1 % wmask1 % wgat1 %> nul cmd/C netsh interface IP add DNS name = "% wname %" % wdns11 % Index = 1> nul cmd/C netsh interface IP add DNS name = "% wname %" % wdns12 % Index = 2> NUL @ echo % wname % IP address set successfully !!! @ Echo. @ echo current IP Address: % wadd1 % @ echo current subnet mask: % wmask1 % @ echo current Default Gateway: % wgat1 % @ echo current dns1 address: % wdns11 % @ echo current dns2 address: % wdns12 % @ echo. @ echo. goto three: wirelessthree @ echo. @ ECHO is setting % wname % IP address. Please wait... Call: autolocall % lname %> nul cmd/C netsh interface IP Set address name = "% wname %" static % wadd2 % wmask2 % wgat2 %> nul cmd/C netsh interface IP add DNS name = "% wname %" % wdns121 % Index = 1> nul cmd/C netsh interface IP add DNS name = "% wname %" % wdns122 % Index = 2> NUL @ echo % wname % IP address set successfully !!! @ Echo. @ echo current IP Address: % wadd2 % @ echo current subnet mask: % wmask2 % @ echo current Default Gateway: % wgat2 % @ echo current dns1 address: % wdns21 % @ echo current dns2 address: % wdns22 % @ echo. @ echo. goto three: Set wireless network connection end: Three :: pause> NUL set shut = "" set/P shut = "enter [<A> return to Main Menu] or press <other key> to exit: "If not" % shut % "=" "(if % shut % NEQ" "set shut = % shut :~ 0, 1%) else (set shut = "") if/I % shut % = A goto home Exit: autolocall CMD/C netsh interface IP Set address name = "% lname %" static 0.0.0.0 0.0.0.0 0.0.0.0> nul cmd/C netsh interface IP Set address name = "% lname %" Source = DHCP> nul cmd/C netsh interface IP Set DNS name = "% lname %" Source = DHCP> NUL:: @ echo % lname % automatic IP address acquisition successful! Goto: EOF: autowireless CMD/C netsh interface IP Set address name = "% wname %" static 0.0.0.0 0.0.0.0 0.0.0.0> nul cmd/C netsh interface IP Set address name = "% wname %" Source = DHCP> nul cmd/C netsh interface IP Set DNS name = "% wname %" Source = DHCP> NUL:: @ echo % wname % automatic IP address acquisition successful! Goto: EOF

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.