0

enter image description here I need the ppp IP address stored into a variable. The only way I have found is 'ipconfig > text.txt' into a tmp file and then script a search for the ppp interface. This is very dirty.

Is there an better alternative in windows?

1

3 Answers 3

1
setlocal enabledelayedexpansion for /f "delims=" %%a in ('ipconfig ^| find /i "IPv4 Address"') do (set VarIP=!%%a%!) Echo Your PPP IP : %VarIP% 
Sign up to request clarification or add additional context in comments.

Comments

1
@echo off for /f "tokens=2,3 delims={,}" %%a in ('"WMIC NICConfig where IPEnabled="True" get IPAddress /value | find "I" "') do echo IPv4 %%~a IPV6 %%~b pause 

Comments

0

You can also extract using ping:

@echo off FOR /F "tokens=2,3" %%A IN ('ping %computername% -n 1 -4') DO IF "from"== "%%A" set "IP=%%~B" echo %IP:~0,-1% 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.