Created
August 22, 2014 11:52
-
-
Save so0k/a185314178768dd05aae to your computer and use it in GitHub Desktop.
CMD Batch that gets the boot2docker ip and updates the host file - powershell can't handle boot2docker ip command... Depends on Update-Hosts / Add-Hosts powershell scripts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ECHO OFF | |
ECHO Getting boot2docker ip... | |
FOR /f "usebackq tokens=*" %%a IN (`boot2docker ip`) DO SET localdocker-ip=%%a | |
ECHO %localdocker-ip% | |
ECHO. | |
ECHO Analyzing hosts file | |
%windir%\System32\FIND /C /I "localdocker" %windir%\System32\drivers\etc\hosts | |
IF %ERRORLEVEL% NEQ 0 ( | |
ECHO localdocker not found, adding to hosts... | |
powershell -command "Add-Hosts.ps1 -hostName \"localdocker\" -hostIp \"%localdocker-ip%\"" | |
) ELSE ( | |
ECHO localdocker found, updating hosts... | |
powershell -command "Update-Hosts.ps1 -hostName \"localdocker\" -hostIp \"%localdocker-ip%\"" | |
) | |
ECHO. | |
@ECHO ON |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment