我查了下以前写的脚本,还这有能用上的(早忘了)。在这整理出来,留做备用。
@echo off
color Bd
title hosts文件修改脚本
for /r "C:\Windows\System32\drivers\etc" %%i in (hosts) do if exist %%i echo 192.168.9.79 ****.com >>%%i
for /r "C:\Windows\System32\drivers\etc" %%i in (hosts) do if exist %%i echo 192.168.9.80 ****.com >>%%i
for /r "C:\Windows\System32\drivers\etc" %%i in (hosts) do if exist %%i echo 192.168.9.81 ****.com >>%%i
for /r "C:\Windows\System32\drivers\etc" %%i in (hosts) do if exist %%i echo 192.168.9.82 ****.com >>%%i
for /r "C:\Windows\System32\drivers\etc" %%i in (hosts) do if exist %%i echo 192.168.9.83 ****.com >>%%i
for /r "C:\Windows\System32\drivers\etc" %%i in (hosts) do if exist %%i echo 192.168.9.84 ****.com >>%%i
for /r "C:\Windows\System32\drivers\etc" %%i in (hosts) do if exist %%i echo 192.168.9.85 ****.com >>%%i
for /r "C:\Windows\System32\drivers\etc" %%i in (hosts) do if exist %%i echo 192.168.9.86 ****.com >>%%i
for /r "C:\Windows\System32\drivers\etc" %%i in (hosts) do if exist %%i echo 192.168.9.121 ****.com >>%%i
echo.
echo hosts文件设置成功
echo.
echo 如果有疑问请联系技术支持:***
echo.
echo.按任意键退出....&pause >nul