// 寻找含有原纪录的行删除,并保存bak备份。findstr /v "www.test.com""C:WindowsSystem32Driversetchosts">>C:WindowsSystem32Driversetchosts.bak//把bak备份恢复cd /d %windir%system32driversetcdel hostsren hosts.bak hosts//插入空行@echo.>>C:WindowsSystem32Driversetchosts@echo.>>C:WindowsSystem32Driversetchosts//写入记录@echo127.0.0.1 www.test.com>>C:WindowsSystem32Driversetchosts

https://www.512873.com/archives/184.html