Created
July 10, 2019 21:11
-
-
Save rodrigonehring/4151cc9a042b2fa30f12e80866e94b49 to your computer and use it in GitHub Desktop.
Update etc/hosts with current wsl2 ip
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 | |
set folder="C:\Users\rodri\Desktop\ip" | |
del "%folder%\hosts" | |
ubuntu1804 -c "ip addr | grep 'eth0' | grep 'inet' | grep -o -P 'inet.{0,14}' | grep -E -o '([0-9]{1,3}[\.]){3}[0-9]{1,3}'" > "%folder%\ip.txt" | |
set /p ip=<"%folder%\ip.txt" | |
echo %ip% | |
echo f | copy /Y "%folder%\hosts-copy" "%folder%\hosts" | |
(echo. & echo %ip% local.gofind) >> %folder%\hosts | |
copy /Y "%folder%\hosts" "C:\Windows\System32\drivers\etc\hosts" | |
PAUSE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment