Windows batch processing automatically sets IP addresses upon startup

Source: Internet
Author: User


The IP address @ echo off www.2cto.com REM select = 1 is automatically set for Windows batch processing, and the nic ip address is set to 172.16.200.34, select = 2, nic IP address is set to 192.168.0.5 ping-n 2 192.168.0.254 & set select = 2 | set select = 1REM get Nic name for/f "skip = 4 tokens = 3 * delims = "% I in ('ipconfig ') do (set adapter = % I goto out): outset adapter = % adapter :: = % if % select % = 1 (netsh int ip set address name = "% adapter %" static 172.16.200.34 255.255.255.0 172.16.200.1 1 netsh I Nt ip set dns name = "% adapter %" static 202.102.224.68 primary netsh int ip add dns name = "% adapter %" 202.102.227.68 index = 2) else (netsh int ip set address name = "% adapter %" static 192.168.0.5 255.255.255.255.0 192.168.0.254 1) echo setting is complete. Press any key to exit! Pause> nul 2> nul
 

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.