中国DOS联盟

-- 联合DOS 推动DOS 发展DOS --

联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum
DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!

中国DOS联盟论坛
现在时间是 2026-07-31 21:18
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » 搜索HOSTS并插入行 查看 3,626 回复 16
16 发表于 2008-09-24 14:05 ·  中国 北京 联通
初级用户
积分 36
发帖 19
注册 2007-12-29 10:53
18年会员
UID 107102
性别 男
状态 离线
我也放个参考上来..因为配置系统做了一个
@echo off
setlocal enabledelayedexpansion
echo Y|cacls %windir%\system32\drivers\etc\hosts /g everyone:f
attrib -r -a -s -h %windir%\system32\drivers\etc\hosts
color 0A
echo.>> %windir%\system32\drivers\etc\hosts
FOR /F "eol=# tokens=1 delims=" %%i in (LIST.txt) do (
FIND "%%i" %windir%\system32\drivers\etc\hosts
IF errorlevel 1 @echo %%i >> %windir%\system32\drivers\etc\hosts
)

@echo on
@echo 按任意键退出安装程序
@echo. & pause 1>nul 2>nul
17 发表于 2008-09-24 14:05 ·  中国 北京 联通
初级用户
积分 36
发帖 19
注册 2007-12-29 10:53
18年会员
UID 107102
性别 男
状态 离线
list.txt的模板
10.96.100.55 mismidt01.pec.com.cn
10.96.100.56 mismidt02.pec.com.cn
10.96.100.57 mismidt03.pec.com.cn
论坛跳转: