請指點!!!- @echo off
- ping -n 6 127.0.0.1>nul
- set IPv40=127.0.0.1
- set koo=1
- set t=40
- set ck=0
-
- :ip_koo
- if 'koo'=='4' Goto end
- for /f %%i in ('ping -w 1 -n 1 -l 1 tw.yahoo.com^|find /c "Request timed out."') do (
- if Not %%i==0 (
- set /a koo=koo+1
- echo 等待 40秒後 重試第 %koo%次
- ping -n 40 127.0.0.1>nul
- Goto ip_koo
- )
- )
-
- cls
-
- for /f "tokens=2 delims=:" %%i in ('ipconfig ^| find /I "IP Address"') do (
- for /f "tokens=1 delims= " %%j in ("%%i") do (
- set IPv41=%%j
- )
- )
-
-
- set koo=1
- if Not '%IPv40%'=='%IPv41%' (
- set /a ck=ck+1
- if 'ck'==2 (
- set /a '%IPv41%'=='%IPv40%'
- echo %IPv41%
- 送出信件....
- )else Goto ip_koo
- )
-
- ping -n %t% 127.0.0.1>nul
-
- Goto ip_koo
-
- :end
- echo 網路無法連線....
- pause>nul
复制代码
|