Code for websites using HOSTS files (blocking, acceleration) for Batch Processing

Source: Internet
Author: User

Copy codeThe Code is as follows: @ echo off & setlocal & cls
Echo/& echo \ & echo = & echo] & echo [& echo +
: Start
Set/p a = select mode (1: blocked websites 2: Accelerated Access 3: deleted blocked websites 4: Exited ):
If not defined a goto start
If % a % equ 1 (echo/& goto)
If % a % equ 2 (echo/& goto B)
If % a % equ 3 (echo/& goto c)
If % a % equ 4 (cls & goto: eof)
Cls
Echo input error. Press any key to start again ......
Pause> nul
Echo/& echo \ & echo = & echo] & echo [& echo +
Goto start
:
Set/p B = enter the address of the website to be blocked (for example, www.baidu.com ):
>>% Systemroot % \ system32 \ drivers \ etc \ hosts echo 0.0.0.0% B %
Echo ********* setting complete ********
Goto: eof
: B
Set/p B = enter the IP address of the host to accelerate access (for example, 192.168.1.6 ):
Set/p bb = enter the host domain name (for example, www.baidu.com) for accelerated access ):
>>% Systemroot % \ system32 \ drivers \ etc \ hosts echo % B % bb %
Echo ********* setting complete ********
Goto: eof
: C
Set/p B = enter the address of the website that has been blocked:
Pushd % systemroot % \ system32 \ drivers \ etc \
> Nul findstr/I "\ <% B % \>" > Hosts. pp findstr/vi "\ <% B % \>" Del/f/q hosts
Ren hosts. pp hosts
Popd
Echo ********* setting complete ********
Goto: eof

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.