Skip to content

Instantly share code, notes, and snippets.

@gusg21
Created December 28, 2016 15:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gusg21/d5c81c70cc0935be006b21673fadcf7d to your computer and use it in GitHub Desktop.
Save gusg21/d5c81c70cc0935be006b21673fadcf7d to your computer and use it in GitHub Desktop.
A command line tool to detect and optionally open the IPV4 address of your router.
:: File: routerip.bat
:: Author: gusg21
::
:: A command line tool to detect and optionally
:: open the ip address of your router.
@echo off
for /f "tokens=2,3 delims={,}" %%a in ('"WMIC NICConfig where IPEnabled="True" get DefaultIPGateway /value | find "I" "') do set IPv4=%%~a && set IPV6=%%~b
echo IPV4: [ %IPV4%]
choice /M "Open this page?"
if %ERRORLEVEL% EQU 1 (
echo Opening %IPV4%...
start "" http://%IPV4%/
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment