Skip to content

Instantly share code, notes, and snippets.

@steelywing
Last active October 28, 2015 14:27
Show Gist options
  • Save steelywing/f10471934f1120248b1a to your computer and use it in GitHub Desktop.
Save steelywing/f10471934f1120248b1a to your computer and use it in GitHub Desktop.
add host entry to windows hosts, run as administrator
@echo off
set hosts_file=%WINDIR%\System32\drivers\etc\hosts
set host=127.0.0.1 fvc_stat.freemake.com
find /i "%host%" %hosts_file% > nul
if %ERRORLEVEL% == 0 (
echo "%host%" already exist.
) else (
(echo. & echo %host%) >> %hosts_file%
echo Added "%host%" to hosts.
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment