我想使用这个批处理脚本通过 Windows 批处理自动将新条目添加到我的主机文件中。
不幸的是,即使我以管理员身份运行脚本,该脚本只会向主机文件添加一行,那么出了什么问题呢?
@echo off
set hostspath=%windir%\System32\drivers\etc\hosts
echo 62.116.159.4 ns1.intranet.de >> %hostspath%
echo 217.160.113.37 ns2.intranet.de >> %hostpath%
echo 89.146.248.4 ns3.intranet.de >> %hostpath%
echo 74.208.254.4 ns4.intranet.de >> %hostpath%
exit