Skip to content

Instantly share code, notes, and snippets.

@deulizealand
Forked from eveyrat/hosts.bat
Created March 1, 2022 04:37
Show Gist options
  • Save deulizealand/2aeb4572b47c4a91bafa2602bc6f2575 to your computer and use it in GitHub Desktop.
Save deulizealand/2aeb4572b47c4a91bafa2602bc6f2575 to your computer and use it in GitHub Desktop.
windows shell script - add hosts entries
@echo off
SET NEWLINE=^& echo.
ECHO %NEWLINE%^ >>%WINDIR%\System32\drivers\etc\hosts
FIND /C /I "heracles.fila" %WINDIR%\system32\drivers\etc\hosts
IF %ERRORLEVEL% NEQ 0 ECHO %NEWLINE%^192.168.5.10 heracles.fila>>%WINDIR%\System32\drivers\etc\hosts
FIND /C /I "www.heracles.fila" %WINDIR%\system32\drivers\etc\hosts
IF %ERRORLEVEL% NEQ 0 ECHO %NEWLINE%^192.168.5.10 www.heracles.fila>>%WINDIR%\System32\drivers\etc\hosts
FIND /C /I "api.heracles.fila" %WINDIR%\system32\drivers\etc\hosts
IF %ERRORLEVEL% NEQ 0 ECHO %NEWLINE%^192.168.5.10 api.heracles.fila>>%WINDIR%\System32\drivers\etc\hosts
FIND /C /I "bracket.heracles.fila" %WINDIR%\system32\drivers\etc\hosts
IF %ERRORLEVEL% NEQ 0 ECHO %NEWLINE%^192.168.5.10 bracket.heracles.fila>>%WINDIR%\System32\drivers\etc\hosts
FIND /C /I "onvenue.heracles.fila" %WINDIR%\system32\drivers\etc\hosts
IF %ERRORLEVEL% NEQ 0 ECHO %NEWLINE%^192.168.5.10 bracket.heracles.onvenue>>%WINDIR%\System32\drivers\etc\hosts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment