gia.bat
1 @echo off 2 color 0a 3 title Get IPv4 Address 1.0 4 5 SETLOCAL ENABLEEXTENSIONS 6 SETLOCAL ENABLEDELAYEDEXPANSION 7 8 set "CS_1=Wireless LAN adapter Wireless Network Connection:" 9 set "CS_2=IPv4 Address. . . . . . . . . . . "10 set _TMP=%TEMP%\.gia.tmp11 12 rem Stage. 1: 13 :PROC_114 cd . > "%_TMP%"15 for /f "tokens=*" %%i in ('ipconfig') do (16 >> "%_TMP%" echo %%i17 )18 for /f "usebackq tokens=1* delims=:" %%i in (`findstr /n /c:"%CS_1%" "%_TMP%"`) do (19 set /a POS_BEGIN=%%i20 goto :PROC_221 )22 echo Err: PROC_123 goto :NORMAL_EXIT24 25 rem Stage. 2: 26 :PROC_227 set /a INDEX=028 for /f "usebackq tokens=1* delims=:" %%i in ("%_TMP%") do (29 set /a INDEX+=130 if !INDEX! gtr %POS_BEGIN% (31 if "%%i" equ "%CS_2%" (32 set _IP=%%j33 goto :PROC_334 )35 )36 )37 echo Err: PROC_238 goto :NORMAL_EXIT39 40 rem Stage. 3: 41 :PROC_342 for /f "tokens=*" %%i in ("%_IP%") do (43 rem echo %%i| clip44 set /p "_CLIP=%%i" < nul | clip45 echo Paste it.46 goto :NORMAL_EXIT47 )48 echo Err: PROC_349 goto :NORMAL_EXIT50 51 :NORMAL_EXIT52 if exist "%_TMP%" del "%_TMP%"53 pause54 exit