Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7811605
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T04:13:38+00:00 2026-06-02T04:13:38+00:00

I need to ping one IP from multiple source IPs and write the results

  • 0

I need to ping one IP from multiple source IPs and write the results to a file or HTML page for the results. i need to get the results from all 4 pings to include TTL and how many of the 4 pings dropped and the ping time.

I know with a IPv6 you can use the -S trigger in the ping command to designate a source IP but how do you do it for a IPv4 environment.

Setup:

Windows 2003 server R2 Standard x64.
.txt file containing 85 IPv4 address i would like to use as the source IPs
1 target IPv4 address
will be run from one central server
will be logged in as admin on the central server

Desired result:
HTML page that displays the results grouped by source IP
Results to include all 4 ping reply times, TTL, total packets sent, total packets received and average ping time in ms

Now let me complicate things a bit. I am not in an environment that allows me to install any additional software that is not include in the windows 2003 server R2 standard x64 normal install. It has been ages since writing .bat files and my memory is still very weak on .bat files. All IP addresses are IPv4. While I do have FQDNs for all these servers I need to use IPs (for one reason or another)

I have the following to create the page desired and ping from one system to many but the rest is where I am having my problems since I need to ping from many to one, and the only results my script gives me is properly formatted html pages but it only says processing=done
Where have I gone wrong… please help…

Thank you

—edit— by changing ping to ping.exe and placing %%i in quotes – “%%i” now i get results but not in the nice format i was hoping for. it gives the results in the format of pining 127.0.0.1 with 32bytes of date: reply from …. as if was just outputing to a text file. what i would like it to do is show it in a table format. have made the changes to the code below.

@echo off
echo ^<HTML^>^<HEAD^><TITLE^>SERVER PING INFO^</TITLE^>^</HEAD^> >>ping-results.html
echo ^<BODY GBCOLOR=#FFFFFF” TEXT=”#000000” LINK+#0000FF” VLINK=#800080”^> >>ping-results.html
echo ^<p align="center"^>^<table border="1" width="600"^> >>ping-results.html
echo ^<tr^>^<td^>^<B^>ping results^</td^> >> ping-results.html
for /F %%i in (c:\ping-results\serverIP.txt) do (
    echo Processing %%i...
    ping.exe "%%i" > "c:\ping-results\%%i.html" /format:htable.xsl
    echo ^<tr^>^<td^>%%i^</td^> >> ping-results.html
    echo ^<td^>^<a href="c:\ping-results\%%i.html"^>Results^</a^>^</td^> >> ping-results.html
    echo ^</tr^> >> ping-results.html
)
    echo ^<p align="center"^>^<b^>^<font size="+1" color="Red"^>^<BR^>Completed at >> ping-results.html time /T >> ping-results.html
echo - on >> ping-results.html
date /T >> ping-results.html
echo ^</font^>^</b^>^<BR^>^</p^> >> ping-results.html
echo.
echo DONE!!
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T04:13:39+00:00Added an answer on June 2, 2026 at 4:13 am

    wouldnt it be best to run the ping command prior to building the html file?

    like this (obvioulsy change the 127.0.0.1 to your server #)

    @echo off
    setlocal enabledelayedexpansion enableextensions
    set count=0
    for /f "delims=" %%a in ('ping -n 4 127.0.0.1') do (
        set /a count=!count!+1
        set pingrspn!count!=%%a
    )
    echo Response1: !pingrspn4!
    echo Response2: !pingrspn5!
    echo Response3: !pingrspn6!
    echo Response4: !pingrspn7!
    

    now you can use the vars: pingrspn4-pingrspn7 in your “build an html file” script.

    nice idea though on the build an html on the fly, i like it.

    One question on the /format option on the ping line, i notice that ping does not have a /format parameter, so is the /format option coming from the redirect symbol?

    [edit]
    so i tweaked your file (you had some missing html code) to format the results (server.html) pages

        :: setlocal options
            setlocal enabledelayedexpansion enableextensions
            set count=0
            for /f "delims=" %%a in ('ping -n 4 127.0.0.1') do (
                set /a count=!count!+1
                set pingrspn!count!=%%a
            )
            echo Response1: !pingrspn4!
            echo Response2: !pingrspn5!
            echo Response3: !pingrspn6!
            echo Response4: !pingrspn7!
    :: write results file       
    echo ^<HTML^>^<HEAD^><TITLE^>SERVER PING INFO^</TITLE^>^</HEAD^> >>ping-results.html 
    echo ^<BODY GBCOLOR=#FFFFFF” TEXT=”#000000” LINK+#0000FF” VLINK=#800080”^> >>ping-results.html 
    echo ^<p align="center"^>^<table border="1" width="600"^> >>ping-results.html 
    echo ^<tr^>^<td^>^<B^>ping results^</td^> >> ping-results.html 
    for /F %%i in (serverIP.txt) do (    
    echo Processing %%i...     
     :: already ran the ping command, so rem it out
    rem ping.exe "%%i" > "%%i.html" /format:htable.xsl   
    :: write %%i.html
    echo ^<HTML^>^<HEAD^><TITLE^>Individual PING^</TITLE^>^</HEAD^> >%%i.html 
    echo ^<BODY GBCOLOR=#FFFFFF” TEXT=”#000000” LINK+#0000FF” VLINK=#800080”^> >>%%i.html 
    echo ^<p align="center"^>^<table border="1" width="600"^> >>%%i.html 
    echo ^<tr^>^<td^>^<B^>results^</td^> >> %%i.html  
            echo ^<tr^>^<td^>!pingrspn4! ^<^/td^>^<^/tr^> >> %%i.html 
            echo ^<tr^>^<td^>!pingrspn5! ^<^/td^>^<^/tr^>  >> %%i.html
            echo ^<tr^>^<td^>!pingrspn6! ^<^/td^>^<^/tr^>  >> %%i.html
            echo ^<tr^>^<td^>!pingrspn7! ^<^/td^>^<^/tr^>  >> %%i.html
            echo ^<^/body^> ^<^/table^> ^<^/html^> >> %%i.html
     echo ^<tr^>^<td^>%%i^</td^> >> ping-results.html     
     echo ^<td^>^<a href="%%i.html"^>Results^</a^>^</td^> >> ping-results.html     
     echo ^</tr^> >> ping-results.html )     
     echo ^<p align="center"^>^<b^>^<font size="+1" color="Red"^>^<BR^>Completed at >> ping-results.html 
     time /T >> ping-results.html 
     echo - on >> ping-results.html 
     date /T >> ping-results.html 
     echo ^</font^>^</b^>^<BR^>^</p^> >> ping-results.html 
     echo ^<^/body^> ^<^/table^> ^<^/html^> >>  ping-results.html 
     echo DONE!!
     ping-results.html
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Need to insert selected text on the page into textarea. There must be some
need to add a 2nd css stylesheet to a page. do i add a
Need some help, please. I have a line of horizontal thumbnails loaded as ONE
need a quick help here. I have a series of hyperlinks all with the
When a user leaves a page, I need to ask him if he wants
I have multiple nodes, of 2 types. One type of node, will do one
I need my application to ping an address I'll specify later on and just
I'm needing to ping about 2500 servers at one time, in intervals of about
I am using subprocess.check_output from pythons subprocess module to execute a ping command. Here
I've been at this for some time now. I need a basic IRC Ping

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.