How to find my VPN client IP in windows
You can use the netsh
command:
For Vista/7:
netsh interface ipv4 show addresses "PPP adapter my_lab"
And one of these for XP:
netsh interface ip show config "PPP adapter my_lab"
Where PPP adapter my_lab can be replaced by the name of any one of your adapters.
Do you know the ip range of the my_lab VPN?
If you do, a batch file like this will do the trick:
@echo off
FOR /F "tokens=2 delims=:" %%a in ('IPCONFIG ^|FIND "IP" ^|FIND "10.2"') do set _IP=%%a
set IP=%_IP:~1%
echo %IP%
But, as it was suggested by heavyd, if you know only the name of the PPP adapter it's better to use the netsh command.
@echo off
FOR /F "tokens=1-6 delims=:. " %%a in ('netsh int ip show address "my_lab" ^|find "IP Address"') do set IP=%%c.%%d.%%e.%%f
echo %IP%
-Updated