返回列表 发帖
可能部分人不知道原理,
我先简单的说下
大家可以打开hosts文件看看(在C:\WINDOWS\system32\drivers\etc里面),如下
# Copyright (c) 1993-1999 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
127.0.0.1 localhostCOPY
只要在最后一行后面加上
127.0.0.1       你想屏蔽的网址    (注意:有7个空格)      
就打不开了(对原理感兴趣的自己BAIDU下)
下面是我写的
@echo off&setlocal enabledelayedexpansion
:kaishi
echo.
echo.
echo.
echo.
echo 添加网址过滤请输入1;解除网址屏蔽请输入2;退出请按0;
set /p scanf=
if !scanf!==1 goto :pb else (
if !scanf!==2 goto:jc else
goto :end)
:pb
set /p str=请输入你想屏蔽的网址:
echo 127.0.0.1 !str!>>C:\WINDOWS\system32\drivers\etc\hosts
echo 网址!str!已经成功屏蔽!
pause & cls & goto :kaishi
:jc
set /p str=请输入你想解除屏蔽的网址:
for /f "delims=" %%a in (C:\WINDOWS\system32\drivers\etc\hosts) do echo %%a | findstr /v "!str!">>C:\WINDOWS\system32\drivers\etc\hosts1
del C:\WINDOWS\system32\drivers\etc\hosts /q
ren C:\WINDOWS\system32\drivers\etc\hosts1 hosts
pause & cls & goto :kaishi
:end
exitCOPY

[ 本帖最后由 novaa 于 2007-11-25 18:58 编辑 ]
ㄗs:A good programming is 99% sweat and 1% coffee!--①個亾

============ >   hi.baidu.com/novaa   <============

TOP

哈哈
发现我写的好马虎
格式排版的也不好
本来想用CHOICE选择的,但是别人告诉,XP没有命令,。。。
ㄗs:A good programming is 99% sweat and 1% coffee!--①個亾

============ >   hi.baidu.com/novaa   <============

TOP

N长,哈哈
不过人性化,
功能足
很不错的啊
向版主学习!
ㄗs:A good programming is 99% sweat and 1% coffee!--①個亾

============ >   hi.baidu.com/novaa   <============

TOP

晕啊
somebody应该知道,批处理作用是有限的!发挥了他的作用就足够了,何必还要说他不能怎么怎么的呢?
利用host是“一种“方法
利用批处理就能简化我们利用这种方法的
这就达到了批处理的目的了,
ㄗs:A good programming is 99% sweat and 1% coffee!--①個亾

============ >   hi.baidu.com/novaa   <============

TOP

返回列表