@echo off
set IP=127.0.0.1
set DOMAIN=example.com
echo. >> C:\Windows\System32\drivers\etc\hosts
for /L %%i in (1,1,100) do (
echo %IP% sub%%i.%DOMAIN% >> C:\Windows\System32\drivers\etc\hosts
)
批量添加hosts域名解析
本文介绍一个Windows批处理脚本,通过循环批量向hosts文件添加域名解析,将127.0.0.1映射到sub1到sub100的example.com子域名,实现快速批量配置。
作者:zhuge··预计阅读 1 分钟·377 阅读·0 评论

评论