Code to modify DNS by batch (recommended) _dos/bat

Source: Internet
Author: User

Batch change DNS (recommended):

Copy Code code as follows:

@echo off
:: Determining local Connection Assignment A
for/f "tokens=3,4 delims=="%%i in (' ipconfig ^|findstr/r "Ben") do Echo%%i%%j
for/f "Tokens=1 delims==:"%%d in (DNS.txt) do set a=%%d
:: Please change the following three lines according to the actual situation
echo starts changing primary DNS
netsh interface ip set DNS name= "%a%" Source=static addr=202.96.128.116
Echo Complete
echo starts changing Vice DNS
netsh interface ip add dns "%a%" 202.96.128.86 index=2
Del DNS.txt
Exit


It is recommended that you add one more

echo Delete original DNS
netsh interface ip del dns name= "%a%" all

Otherwise, the original DNS can not be modified AH hey

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.