This one's a bit flaky...better ways to do it...![Sad Sad](https://forums.nextpvr.com/images/smilies/sad.png)
Here's a crude way to get your public ip address from batch without service! [no whatismyip,etc]
Using tracert, traces the route to a non-existant website [1.1.1.1, or use *any* address] and watches the server hops as it goes out..
It ignores 192. and 10. and 172.x.x.x adresses so should skip the internal adapter and router..[ymmv tho]
It may need tweaking if you use weird local ip, or multiple routers..
but once you tweak it for your setup if needed, it should work fine from then on...[unless you add another router hop in the mix]
I'm curious to hear what setups it DOESN't work on... let me know..![Smile Smile](https://forums.nextpvr.com/images/smilies/smile.png)
here 'tis:
or a one liner:
Replace @echo with 'set publicip=' and you now have a variable you can process further..
Handy for navigating back to your EWA, you could email ip to yourself when it changes..![Wink Wink](https://forums.nextpvr.com/images/smilies/wink.png)
Enjoy
![Sad Sad](https://forums.nextpvr.com/images/smilies/sad.png)
Here's a crude way to get your public ip address from batch without service! [no whatismyip,etc]
Using tracert, traces the route to a non-existant website [1.1.1.1, or use *any* address] and watches the server hops as it goes out..
It ignores 192. and 10. and 172.x.x.x adresses so should skip the internal adapter and router..[ymmv tho]
It may need tweaking if you use weird local ip, or multiple routers..
but once you tweak it for your setup if needed, it should work fine from then on...[unless you add another router hop in the mix]
I'm curious to hear what setups it DOESN't work on... let me know..
![Smile Smile](https://forums.nextpvr.com/images/smilies/smile.png)
here 'tis:
Code:
@for /f "tokens=5,8,9,10,11 skip=3 delims=. " %%e in ('tracert -d -h 5 -w 50 1.1.1.1') do (
if %%f NEQ 192 (if %%f NEQ 10 (if %%f NEQ 172 (@echo %%f.%%g.%%h.%%i
pause
goto :eof
)))
)
or a one liner:
Code:
@for /f "tokens=8,9,10,11 skip=3 delims=. " %%f in ('tracert -d -h 5 -w 50 1.1.1.1') do @if %%f NEQ 192 (@if %%f NEQ 10 (@if %%f NEQ 172 (@echo %%f.%%g.%%h.%%i & goto :eof)))
Handy for navigating back to your EWA, you could email ip to yourself when it changes..
![Wink Wink](https://forums.nextpvr.com/images/smilies/wink.png)
Enjoy
Hardware: HDHR Prime, HDPVR 1212, Raspberry pi2, VFD display w/LCDSmartie