cd /d %windir%\system32\drivers\etc
rem Delete first to prevent renaming failure
del
ren hosts
for /f "eol=# tokens=1,2" %%i in () do call :checkvalue %%i %%j
goto end
:checkvalue
echo %2 | find /i "local"
if %errorlevel%==1 (echo %1 %2 >>hosts)
:end