Skip to content

Instantly share code, notes, and snippets.

@maciakl
Created January 13, 2022 15:54
Show Gist options
  • Select an option

  • Save maciakl/5659266b20e9d6a199cbaeaa129ef7e2 to your computer and use it in GitHub Desktop.

Select an option

Save maciakl/5659266b20e9d6a199cbaeaa129ef7e2 to your computer and use it in GitHub Desktop.
Get your public/routable ip address from the windows command line
@echo off
for /f "tokens=1* delims=: " %%A in (
'nslookup myip.opendns.com. resolver1.opendns.com 2^>NUL^|find "Address:"'
) Do set ExtIP=%%B
echo %ExtIP%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment