Getting adresses of webpages IP windows prompt

32 views Asked by At

I have to compapare if link exist in database already. I have list of new or existing already websites in txt.file I wanted to do it by PINGing websites from database, + ping new and compare ip adresses. txt ipnut:

google.com
yahoo.com
example.com
...

txt output:

    google.com;[ip adress]
    yahoo.com;[ip adress]
    example.com;[ip adress]
    ...

i have code which works only partially, i just want to get this adress from @Pinging example.com [193.138.15.20] and write it to file like now : adress = company name adress ? If you have some better solution in powershell please tell me. thanks

@ECHO OFF
    SETLOCAL enableextensions
    for /F "usebackq delims=" %%i in ("d:\companies.txt") do (
      set "_found="
      for /F "tokens=3 delims=: " %%G in ('ping -4 -n 1 %%i^|findstr /i "TTL="') do (
        echo %%G = %%i
        set "_found=%%G"
      )
      if not defined _found (
        for /F "tokens=2 delims=[]" %%G in ('ping -4 -n 1 %%i^|findstr /ib "Pinging"') do (
          echo %%G ? %%i
          rem set "_found=%%G"
        )
      )
    )>>d:\NOWY.txt
0

There are 0 answers