- @echo off&setlocal enabledelayedexpansion
-
- title code by ieutk @ bbs.bathome.net
-
- mode con: cols=65 lines=12
-
- color 1b
-
- set "split=4"
-
- set "_split=0"
-
- set "num=0"
-
- :main
-
- cls&echo.&echo.
-
- set input=
-
- set /p input= 请输入WEB地址:
-
- if not defined input goto main
-
- for /f "tokens=4 delims=: " %%a in ('ping /n 1 %input%^|find /i "ping statistics"') do set "ip=%%a"
-
- set "ip=%ip:.= %"
-
- set /a n3=256*256*256,n2=256*256
-
- call :pd
-
- for /f "tokens=1-4 delims= " %%a in ("%ip%") do (
-
- set "ie=%%a"
-
- set /a sc=%%b*n2+%%c*256+%%d
-
- )
-
- set /a fs1=a1*ie,fs2=a2*ie
-
- call set /a fsn=%%fs2:~0,-%split%%%+fs1
-
- call set fs=%fsn%%%fs2:~-%split%%%
-
- call :lh
-
- call set /a zh=%%fs:~-%_split%%%+sc
-
- if not "!zh:~%_split%,1!"=="" (
-
- call set /a _h=%%fs:~0,-%_split%%%+%%zh:~0,-%_split%%%
-
- call set hh=%%_h%%%%zh:~-%_split%%%
-
- ) else (
-
- call set hh=%%fs:~0,-%_split%%%%zh%
-
- )
-
- echo %hh%
-
- echo.&pause&goto :eof
-
-
- :pd
- if "!n3:~-%split%,1!"=="0" (
-
- set /a split-=1
-
- goto pd
-
- ) else (
-
- call set a1=%%n3:~0,-%split%%%
-
- call set a2=%%n3:~-%split%%%
-
- goto :eof
-
- )
-
-
- :lh
-
- if not "!sc:~%num%,1!"=="" (set /a _split+=1) else (goto :eof)
-
- set /a num+=1
-
- goto lh
复制代码 看看是不是要这样的结果? |