Situatie
Solutie
Pasul 1:
Copiem codul de mai jos intr-un editor de text.
@echo off
Title Get LAN ,Public IP
mode con cols=45 lines=5 & Color 9E
Set “LogFile=%~dp0%~n0.txt”
@for /f “delims=[] tokens=2” %%a in (‘ping -4 -n 1 %ComputerName% ^| findstr [‘) do (
set “LAN_IP=%%a”
)
for /f “tokens=2 delims=: ” %%A in (
‘nslookup myip.opendns.com. resolver1.opendns.com 2^>NUL^|find “Address:”‘
) Do set ExtIP=%%A
Cls
echo(
echo My Private LAN IP : %LAN_IP%
echo My External Public IP : %ExtIP%
(
echo My Private LAN IP : %LAN_IP%
echo My External Public IP : %ExtIP%
)>”%LogFile%”
Timeout /T 3 /NoBreak>nul
Start “” “%LogFile%”
Pasul 2:
Salvam textul punandu-i orice nume + .bat la sfarsit.
In cazul in care codul nu functioneaza, ar trebui sa inlocuim simbolul ” deoarece site-ul ii schimba formatul.
Leave A Comment?