屏蔽网站命令

作者:admin发表时间:2010-8-24 评论:0 点击 1,809+

@echo off


    @setlocal ENABLEDELAYEDEXPANSION


    title 可屏蔽网址的批处理。
color 0a
    :begin


    mode con cols=50 lines=56


    echo ------------------------------------------------


    echo *****************选择如下操作********************


    echo.


    echo.


    echo ***************1.添加要屏蔽的网址****************


    echo ***************2.删除已屏蔽的网址****************


    echo ***************3.查找已屏蔽的网址****************


    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=输入要添加的网址:


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


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


    echo 成功添加屏蔽网址%input%


    echo 请准确的输入或者按n跳到chose!


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


    pause


    cls


    goto begin


    :del


    echo ~_~你选择了删除操作切记务必最好输入完整的网址~_~


    set /p del=输入要删除的网址:


    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 请准确的输入或者按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

顶一下 0 踩一下 0

你可能对以下内容感兴趣!

  1. 微软一个罕为人知的无敌命令

发表评论

*

w_0002.gif w_0009.gif w_0007.gif w_0011.gif w_0005.gif w_0008.gif w_0010.gif w_0003.gif w_0012.gif w_0001.gif w_0006.gif