How to use HOSTS files to block and accelerate websites in batch processing
This article mainly shows you the "batch processing how to use HOSTS files to block and accelerate the site", the content is easy to understand, well-organized, hope to help you solve your doubts, the following let the editor lead you to study and learn "batch processing how to use HOSTS files to block and accelerate the website" this article.
The code is as follows:
@ echo off&setlocal&cls
Echo/&echo\ & echo=&echo] & echo [& echo+
: start
Set/p a = selection mode (1: blocking websites 2: accelerating access 3: deleting blocked websites 4: exiting):
If not defined a goto start
If an equ 1 (echo/&goto a)
If an equ 2 (echo/&goto b)
If an equ 3 (echo/&goto c)
If a% equ 4 (cls&goto: eof)
Cls
Echo typing error, press any key to start over.
Pause > nul
Echo/&echo\ & echo=&echo] & echo [& echo+
Goto start
: a
Set/p b = enter the address of the website to be blocked (e.g. www.baidu.com):
>% systemroot%\ system32\ drivers\ etc\ hosts echo 0.0.0.0% b%
Echo * setup complete *
Goto: eof
: b
Set/p b = enter the host IP to accelerate access (for example: 192.168.1.6):
Set/p bb= enter the domain name of the host to accelerate access (such as www.baidu.com):
>% systemroot%\ system32\ drivers\ etc\ hosts echo% b% bb%
Echo * setup complete *
Goto: eof
: c
Set/p b = enter the address of the website that was once blocked:
Pushd% systemroot%\ system32\ drivers\ etc\
> nul findstr / I "\" > hosts.pp findstr / vi "\"