您好,我想直接从命令提示符阻止一些网站。
回声如下:
0.0.0.0 websitename.com我该怎么做呢?(操作系统: Windows 7)
发布于 2010-11-19 12:29:17
echo 0.0.0.0 websitename.com >> %WINDIR%\System32\Drivers\Etc\Hosts
>>将echo的输出附加到文件中。
请注意,有两个原因可能不会像您希望的那样工作。您可能知道这些,但我提到它们只是为了以防万一。
首先,它不会影响web浏览器,例如,已经解析了当前“真实”IP地址的浏览器。因此,它不会总是立即生效。
其次,它要求您为域中的每个主机名添加一个条目;例如,仅添加websitename.com并不会阻止www.websitename.com。
发布于 2011-11-16 06:16:19
使用主机指挥官。它简单而强大。你可以从here下载。
使用示例
hosts add another.dev 192.168.1.1 # Remote host
hosts add test.local # 127.0.0.1 used by default
hosts set myhost.dev # new comment
hosts rem *.local
hosts enable local*
hosts disable localhost...and还有很多其他的.
帮助
Usage:
hosts - run hosts command interpreter
hosts <command> <params> - execute hosts command
Commands:
add <host> <aliases> <addr> # <comment> - add new host
set <host|mask> <addr> # <comment> - set ip and comment for host
rem <host|mask> - remove host
on <host|mask> - enable host
off <host|mask> - disable host
view [all] <mask> - display enabled and visible, or all hosts
hide <host|mask> - hide host from 'hosts view'
show <host|mask> - show host in 'hosts view'
print - display raw hosts file
format - format host rows
clean - format and remove all comments
rollback - rollback last operation
backup - backup hosts file
restore - restore hosts file from backup
recreate - empty hosts file
open - open hosts file in notepadhttps://stackoverflow.com/questions/4222045
复制相似问题