[已解决]如何使用批处理添加受限制网站

本文提供了一种通过批处理脚本修改hosts文件来禁用特定视频网站的方法,以阻止员工在工作时间访问这些网站。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

我是在家酒店当网管,有些员工老是在上班时间看电影,比如土豆,优酷之类的视频网站..
自己也在网上搜索过类似的批处理,但是没有达到预期的效果...

在这里我想求个批处理,主要是能达到禁止指定的一些网站,让其无法登陆..




本帖最后由 ask0199 于 2011-12-8 15:11 编辑

自己已经找到了...
代码如下:
  1. @echo off
  2. attrib -s -r -h C:\WINDOWS\system32\drivers\etc\hosts
  3. echo 192.168.22.23 qq.com>>C:\WINDOWS\system32\drivers\etc\hosts
  4. echo 192.168.22.23 www.qq.com>>C:\WINDOWS\system32\drivers\etc\hosts
  5. echo 192.168.22.23 www.youku.com>>C:\WINDOWS\system32\drivers\etc\hosts
  6. echo 192.168.22.23 www.tudou.com>>C:\WINDOWS\system32\drivers\etc\hosts
  7. echo 192.168.22.23 www.xunlei.com>>C:\WINDOWS\system32\drivers\etc\hosts
  8. echo 192.168.22.23 www.56.com>>C:\WINDOWS\system32\drivers\etc\hosts
  9. echo 192.168.22.23 220.179.115.42>>C:\WINDOWS\system32\drivers\etc\hosts
  10. echo 192.168.22.23 www.iqiyi.com>>C:\WINDOWS\system32\drivers\etc\hosts
  11. echo 192.168.22.23 tv.sohu.com>>C:\WINDOWS\system32\drivers\etc\hosts
  12. echo 192.168.22.23 www.pptv.com>>C:\WINDOWS\system32\drivers\etc\hosts
  13. echo 192.168.22.23 www.letv.com>>C:\WINDOWS\system32\drivers\etc\hosts
  14. echo 192.168.22.23 v.ifeng.com>>C:\WINDOWS\system32\drivers\etc\hosts
  15. echo 192.168.22.23 www.cntv.cn>>C:\WINDOWS\system32\drivers\etc\hosts
  16. echo 192.168.22.23 www.imgo.tv>>C:\WINDOWS\system32\drivers\etc\hosts
  17. echo 192.168.22.23 www.jstv.com>>C:\WINDOWS\system32\drivers\etc\hosts
  18. echo 192.168.22.23 www.umiwi.com>>C:\WINDOWS\system32\drivers\etc\hosts
  19. echo 192.168.22.23 www.smgbb.cn>>C:\WINDOWS\system32\drivers\etc\hosts
  20. echo 192.168.22.23 www.umiwi.com>>C:\WINDOWS\system32\drivers\etc\hosts
  21. echo 192.168.22.23 video.sina.com.cn>>C:\WINDOWS\system32\drivers\etc\hosts
  22. echo 192.168.22.23 www.m1905.com>>C:\WINDOWS\system32\drivers\etc\hosts
  23. echo 192.168.22.23 www.ku6.com>>C:\WINDOWS\system32\drivers\etc\hosts
  24. attrib +s +r C:\WINDOWS\system32\drivers\etc\hosts
  25. echo OK
  26. pause>nul


  1. @echo off
  2. attrib -s -r -h C:\WINDOWS\system32\drivers\etc\hosts
  3. (echo 192.168.22.23 qq.com
  4. echo 192.168.22.23 www.qq.com
  5. echo 192.168.22.23 www.youku.com
  6. echo 192.168.22.23 www.tudou.com
  7. echo 192.168.22.23 www.xunlei.com
  8. echo 192.168.22.23 www.56.com
  9. echo 192.168.22.23 220.179.115.42
  10. echo 192.168.22.23 www.iqiyi.com
  11. echo 192.168.22.23 tv.sohu.com
  12. echo 192.168.22.23 www.pptv.com
  13. echo 192.168.22.23 www.letv.com
  14. echo 192.168.22.23 v.ifeng.com
  15. echo 192.168.22.23 www.cntv.cn
  16. echo 192.168.22.23 www.imgo.tv
  17. echo 192.168.22.23 www.jstv.com
  18. echo 192.168.22.23 www.umiwi.com
  19. echo 192.168.22.23 www.smgbb.cn
  20. echo 192.168.22.23 www.umiwi.com
  21. echo 192.168.22.23 video.sina.com.cn
  22. echo 192.168.22.23 www.m1905.com
  23. echo 192.168.22.23 www.ku6.com)>>C:\WINDOWS\system32\drivers\etc\hosts
  24. attrib +s +r C:\WINDOWS\system32\drivers\etc\hosts
  25. echo OK
  26. pause>nul









评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值