REM 主選單
:MENU
cls
For /f "tokens=2 delims=: " %%A in (‘nslookup myip.opendns.com. resolver1.opendns.com 2^>NUL^|find "Address:"‘) Do (Set ExtIP=%%A)
@Echo.
Echo External IP is : %ExtIP%
REM 若有變動則寫入IP.log 檔中
if not "%ExtOldIP%" == "%ExtIP%" (
Echo Time:%time:~0,8% External IP is: %ExtIP% >> IP.log )
set ExtOldIP=%ExtIP%
REM 每隔多久重新偵測一次
timeout /t 5
goto menu
:END