Results 1 to 7 of 7

Thread: Dos/Windows ping utility for multiple hosts

  1. #1
    Taz
    Taz is offline
    Senior Member Taz's Avatar
    Join Date
    Jan 2005
    Location
    London
    Posts
    2,152
    Thanks
    57
    Thanked
    29 times in 27 posts
    • Taz's system
      • Motherboard:
      • Gigabyte Z270 HD3P
      • CPU:
      • Intel Core i5 7600K
      • Memory:
      • Corsair CMK16GX4M2B3200C16R Vengeance LPX 16 GB
      • Storage:
      • Samsung 960 EVO M.2-2280 500GB (PCIe) + 1TB Sandisk Ultra II SSD (SATA)
      • Graphics card(s):
      • Asus NVIDIA GeForce GTX 1070 OC
      • PSU:
      • Corsair CS550M 550W Hybrid
      • Case:
      • NZXT Source 340
      • Operating System:
      • Windows 10 Pro
      • Monitor(s):
      • 34" Asus Designo Curve MX34VQ UWQHD Monitor
      • Internet:
      • Virgin Media M350

    Dos/Windows ping utility for multiple hosts

    Does anybody know of a simple ping utility for DOS or Windows that can ping multiple hosts (via a supplied file of simply copying/pasting a list of hosts) and that can simply display if the hosts responded or not?

    The kind of output i'm after is along the lines of:

    host1 - alive
    host2 - alive
    host3 - dead
    host4 - alive
    host5 - dead
    host6 - dead

    ...and so on.

    The standard DOS ping utility in XP/2003 produces too much output and is hard to process easily as i've scripted it to read the list of hosts from a file and that list contains many machines.

  2. #2
    Jay
    Jay is offline
    Gentlemen.. we're history Jay's Avatar
    Join Date
    Aug 2006
    Location
    Jita
    Posts
    8,365
    Thanks
    304
    Thanked
    568 times in 409 posts

    Re: Dos/Windows ping utility for multiple hosts

    maybe Look@lan may help you?

    http://www.lookatlan.com/download_lal.html
    Last edited by Jay; 22-08-2007 at 11:44 AM.
    □ΞVΞ□

  3. #3
    Agent of the System ikonia's Avatar
    Join Date
    May 2004
    Location
    South West UK (Bath)
    Posts
    3,736
    Thanks
    39
    Thanked
    75 times in 56 posts

    Re: Dos/Windows ping utility for multiple hosts

    something like network notepad may also be of use
    It is Inevitable.....


  4. #4
    Ex-MSFT Paul Adams's Avatar
    Join Date
    Jul 2003
    Location
    %systemroot%
    Posts
    1,926
    Thanks
    29
    Thanked
    77 times in 59 posts
    • Paul Adams's system
      • Motherboard:
      • Asus Maximus VIII
      • CPU:
      • Intel Core i7-6700K
      • Memory:
      • 16GB
      • Storage:
      • 2x250GB SSD / 500GB SSD / 2TB HDD
      • Graphics card(s):
      • nVidia GeForce GTX1080
      • Operating System:
      • Windows 10 x64 Pro
      • Monitor(s):
      • Philips 40" 4K
      • Internet:
      • 500Mbps fiber

    Re: Dos/Windows ping utility for multiple hosts

    Code:
    @echo off
    for /f %%i in (hosts.txt) do call ::pingit %%i
    
    :pingit
    if "%1"=="" goto END
    ping -n 1 %1 >nul
    if errorlevel 1 goto FAIL
    echo %1 - alive
    goto END
    
    :FAIL
    echo %1 - dead
    
    :END
    Save that into a batch file and have your list of machine names in a plain text file HOSTS.TXT, that should give the output you want?
    ~ I have CDO. It's like OCD except the letters are in alphabetical order, as they should be. ~
    PC: Win10 x64 | Asus Maximus VIII | Core i7-6700K | 16GB DDR3 | 2x250GB SSD | 500GB SSD | 2TB SATA-300 | GeForce GTX1080
    Camera: Canon 60D | Sigma 10-20/4.0-5.6 | Canon 100/2.8 | Tamron 18-270/3.5-6.3

  5. Received thanks from:

    Taz (22-08-2007)

  6. #5
    Agent of the System ikonia's Avatar
    Join Date
    May 2004
    Location
    South West UK (Bath)
    Posts
    3,736
    Thanks
    39
    Thanked
    75 times in 56 posts

    Re: Dos/Windows ping utility for multiple hosts

    ahhh so : is how you handle functions in a dos based script.

    Thank you for that Paul
    It is Inevitable.....


  7. #6
    Taz
    Taz is offline
    Senior Member Taz's Avatar
    Join Date
    Jan 2005
    Location
    London
    Posts
    2,152
    Thanks
    57
    Thanked
    29 times in 27 posts
    • Taz's system
      • Motherboard:
      • Gigabyte Z270 HD3P
      • CPU:
      • Intel Core i5 7600K
      • Memory:
      • Corsair CMK16GX4M2B3200C16R Vengeance LPX 16 GB
      • Storage:
      • Samsung 960 EVO M.2-2280 500GB (PCIe) + 1TB Sandisk Ultra II SSD (SATA)
      • Graphics card(s):
      • Asus NVIDIA GeForce GTX 1070 OC
      • PSU:
      • Corsair CS550M 550W Hybrid
      • Case:
      • NZXT Source 340
      • Operating System:
      • Windows 10 Pro
      • Monitor(s):
      • 34" Asus Designo Curve MX34VQ UWQHD Monitor
      • Internet:
      • Virgin Media M350

    Re: Dos/Windows ping utility for multiple hosts

    Quote Originally Posted by Paul Adams View Post
    Code:
    @echo off
    for /f %%i in (hosts.txt) do call ::pingit %%i
    
    :pingit
    if "%1"=="" goto END
    ping -n 1 %1 >nul
    if errorlevel 1 goto FAIL
    echo %1 - alive
    goto END
    
    :FAIL
    echo %1 - dead
    
    :END
    Save that into a batch file and have your list of machine names in a plain text file HOSTS.TXT, that should give the output you want?

    Thanks a lot for that, Paul. I shall try it out.

  8. #7
    Taz
    Taz is offline
    Senior Member Taz's Avatar
    Join Date
    Jan 2005
    Location
    London
    Posts
    2,152
    Thanks
    57
    Thanked
    29 times in 27 posts
    • Taz's system
      • Motherboard:
      • Gigabyte Z270 HD3P
      • CPU:
      • Intel Core i5 7600K
      • Memory:
      • Corsair CMK16GX4M2B3200C16R Vengeance LPX 16 GB
      • Storage:
      • Samsung 960 EVO M.2-2280 500GB (PCIe) + 1TB Sandisk Ultra II SSD (SATA)
      • Graphics card(s):
      • Asus NVIDIA GeForce GTX 1070 OC
      • PSU:
      • Corsair CS550M 550W Hybrid
      • Case:
      • NZXT Source 340
      • Operating System:
      • Windows 10 Pro
      • Monitor(s):
      • 34" Asus Designo Curve MX34VQ UWQHD Monitor
      • Internet:
      • Virgin Media M350

    Re: Dos/Windows ping utility for multiple hosts

    Paul, it worked like a champ. I created a file called pinger2.bat with the following:

    Code:
    @echo off
    echo Pinger Utility V2.0
    echo.
    
    if "%1" NEQ "" goto :checkfile
    echo Usage: pinger2 hosts_file
    echo.
    goto :eof
    
    :checkfile
    if exist %1 goto :doping
    echo Input file does not exist
    echo.
    goto :eof
    
    :doping
    for /f "tokens=*" %%I in (%1) do call ::pingmachine %%I
    goto :eof
    
    :pingmachine
    ping -n 1 %1 >nul
    if errorlevel 1 goto FAIL
    echo %1 - alive
    goto END
    
    :FAIL
    echo %1 - dead
    
    :END
    ::DONE
    I just do a bit of parameter checking at the beginning but the rest is essentially Paul's code. I then created an input hosts file called 'myfile.txt' with the following contents:

    Code:
    127.0.0.1
    blahblah
    I then ran the batch file as follows:

    Code:
    C:\Temp>pinger2 myfile.txt
    This produces the following output:

    Code:
    Pinger Utility V2.0
    
    127.0.0.1 - alive
    blahblah - dead
    Hurrah!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •