Get the App
SLTechnology News&Howtos  ›  Development  › 

How to realize website blocking and unblocking by batch processing

Shulou Source: shulou.com Published: 2022-06-03 05:36:52 10月03日 Update

This article mainly shows you "how to achieve website blocking and unblocking by batch processing". The content is easy to understand and clear. I hope it can help you solve your doubts. Let me lead you to study and learn the article "how to achieve website blocking and unblocking by batch processing".

@ echo off&color 0f&title URL blocking / unblocking

: loop

Setlocal EnableDelayedExpansion

Set wjm=C:\ WINDOWS\ system32\ drivers\ etc

Set "str=127.0.0.1"

Set "xsxx=echo\ & echo Note: this operation requires the consent of the antivirus software."

Set "xsxx=%xsxx%&echo = & echo\"

Cls&%xsxx%

Echo\ & echo the following are blocked URLs & echo = & echo\

For / f "tokens=1* delims="% an in (% wjm%\ hosts) do (

If "% a" = "127.0.0.1" set / a xs+=1

If! xs! Geq 2 (

Set / a num+=1

Set! numbing eggs%% baked echo ^ (! num! ^)% b

)

Set no=%%a b

)

Echo\

If "% no%" = = "127.0.0.1 localhost" (cls&%xsxx%&echo\ & echo currently has no blocked URL.

Echo = & echo\ & echo\)

If defined pinbi goto jiec

If defined pinbi3 goto quan

Echo\ & echo Please select 1 to block the URL and 2 to unblock. (3) all the shielding was lifted. & echo\

Set / p xuan= Please choose [1J 2je 3]?

If "% xuan%" = = "2" (endlocal&set pinbi=a&goto loop)

If "% xuan%" = = "3" (endlocal&set pinbi3=%num%&goto loop)

Cls&%xsxx%

Echo\ & echo Please enter a "single" URL that needs to be "blocked".

Echo\ & echo or enter all the URLs you want to block in "some document", one for each line.

Echo\ & echo then enter the "document name" here (including the full path and suffix name), which can be added in batch.

Echo\ & echo press enter or click close button to exit. & echo\

Set / p wdm= Please enter the document name or URL:

If "% wdm%" = "" exit

If not exist wdm% set wdm= 'wdm%'

For / f "delims=" an in (% wdm%) do (

Color cf&echo! stringing% a > >% wjm%\ hosts

)

Cls&echo\ & echo shielded successfully.

Endlocal&set pinbi=

Goto loop

: jiec

Echo\ & echo enter the serial number in front of the blocked URL to unblock the corresponding URL.

Echo\ & echo is unmasked. You can enter multiple sequence numbers at a time and separate them with spaces. For example, 1 2 5 10 (that is, release 1, 2, 5, 10)

Echo\ & echo press enter or click close button to exit. & echo\

Set / p wz= Please enter the serial number:

If not defined wz exit

: quan

Cd. >% wjm%\ hosts1

Color 1f

If defined pinbi3 for / l% I in (1 1% pinbi3%) do set WZ% I

For / f "delims="% an in (% wjm%\ hosts) do (

Set pin=

For% I in (% wz%) do if "% a" = "! stringing percent% I!" Set pin=a

If not defined pin echo a > > wjm%\ hosts1

)

Del/q% wjm%\ hosts

Ren% wjm%\ hosts1 hosts

Del/q% wjm%\ hosts1

Cls&echo\ & echo unblocked successfully.

Endlocal&set pinbi=&set pinbi3=

Goto loop

The above is all the contents of the article "how to block and unblock websites in batches". Thank you for your reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: URL input website content serial number document article success enter key button study help select line single suffix multiple easy to understand more antivirus software Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi Microsoft Shulou Tech Info OPPO Reno Huawei