1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
@echo off set IP-OLD=127.0.0.1 set IP-NEW=0.0.0.0 set file=%SystemRoot%\system32\drivers\etc\hosts for /f "tokens=*" %%a in (%file%) do call :wri %%a type "%file%.bak" > "%file%" del /f /q /a "%file%.bak" goto :eof :wri set lin=%* call set lin=%%lin:%IP-OLD%=%IP-NEW%%% echo %lin%>>"%file%.bak" goto :eof |