屏蔽惡意網(wǎng)址的代碼

  

    @echo off

    @setlocal ENABLEDELAYEDEXPANSION

    title 可屏蔽網(wǎng)址的批處理。

    :begin

    mode con cols=50 lines=56

    echo *************************************************

    echo *****************選擇如下操作********************

    echo.

    echo.

    echo ***************1.添加要屏蔽的網(wǎng)址****************

    echo ***************2.刪除已屏蔽的網(wǎng)址****************

    echo ***************3.查找已屏蔽的網(wǎng)址****************

    echo ***************4.退出****************************

    echo.

    copy %systemdrive%\WINDOWS\system32\drivers\etc\hosts %systemdrive%\WINDOWS\system32\drivers\etc\hosts.txt>nul

    :chose

    set /p enter=請你輸入你的選擇:

    echo.

    if /i “%enter%”==“1” goto add

    if /i “%enter%”==“2” goto del

    if /i “%enter%”==“3” goto check

    if /i “%enter%”==“4” goto end

    :add

    set /p input=輸入要添加的網(wǎng)址:

    if /i “%input%”==“n” goto chose

    echo 127.0.0.1 %input%》%systemdrive%\WINDOWS\system32\drivers\etc\hosts.txt

    echo 成功添加屏蔽網(wǎng)址%input%

    echo 請準(zhǔn)確的輸入或者按n跳到chose!

    copy %systemdrive%\WINDOWS\system32\drivers\etc\hosts.txt %systemdrive%\WINDOWS\system32\drivers\etc\hosts>nul

    pause

    cls

    goto begin

    :del

    echo ~_~你選擇了刪除操作切記務(wù)必最好輸入完整的網(wǎng)址~_~

    set /p del=輸入要刪除的網(wǎng)址:

    if /i “%del%”==“n” goto chose

    @for /f “tokens=* delims=” %%i in (‘findstr /i /v /c:%del% %systemdrive%\WINDOWS\system32\drivers\etc\hosts.txt’) do (

    set var=%%i

    echo !var!》b.txt

    )

    copy b.txt %systemdrive%\WINDOWS\system32\drivers\etc\hosts.txt>nul

    del b.txt

    echo 操作完成

    echo 請準(zhǔn)確的輸入或者按n跳到chose!

    copy %systemdrive%\WINDOWS\system32\drivers\etc\hosts.txt %systemdrive%\WINDOWS\system32\drivers\etc\hosts>nul

    pause

    cls

    goto begin

    :check

    for /f “tokens=2 delims= ” %%i in (‘findstr /i /c:“www” %systemdrive%\WINDOWS\system32\drivers\etc\hosts.txt’) do (set var=%%i

    echo !var!

    )

    for /f “tokens=2 delims= ” %%i in (‘findstr /i /c:“bbs” %systemdrive%\WINDOWS\system32\drivers\etc\hosts.txt’) do (set var=%%i

    echo !var!

    )

    copy %systemdrive%\WINDOWS\system32\drivers\etc\hosts.txt %systemdrive%\WINDOWS\system32\drivers\etc\hosts>nul

    pause

    goto begin

    :end

    copy %systemdrive%\WINDOWS\system32\drivers\etc\hosts.txt %systemdrive%\WINDOWS\system32\drivers\etc\hosts>nul

    del %systemdrive%\WINDOWS\system32\drivers\etc\hosts.txt

    exit

北大青鳥網(wǎng)上報(bào)名
北大青鳥招生簡章