batch file - Finding specific IP address and echo results -


i have multiple ip address in ipv4. using commands

ipconfig | findstr /r /c:"ipv4 address"

will show multiple results

i'm looking batch file capture specific ipv4 address starts

192

and display full ip address:

192.168.100.232

with results split segments like

a=192
b=168
c=100
d=232

so can echo %a.%b.%c.%d

which display

192.168.100.232

as need telnet lots of devices multiple address. annoying keep searching ip address.

so codes have result shown below:

telnet %a.%b.%c.80

you can try

@echo off     setlocal enableextensions disabledelayedexpansion      set "match=10"      set "ip="     /f "tokens=1-3 delims=. " %%a in ('         route  print -4 %match%.* ^| find /v "..."     ') (         if not defined ip if "%%a"=="%match%" set "ip=%%a.%%b.%%c.80"     )      if not defined ip (         echo ip address not found         goto :eof     )      echo %ip% 

Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -