3

I want to made a bat file that made to me a report with ping every 1 second + the time and date. I use Windows 7 . I tried to read here but doesn't help to me.

Thanks !!

1

2 Answers 2

2

Same as Linux, output ping command to text,

ping 8.8.8.8 > pingy_mac_pingersen.txt

Contents of pingy_mac_pingersen.txt;

Pinging 8.8.8.8 with 32 bytes of data:
Reply from 8.8.8.8: bytes=32 time=97ms TTL=52
Reply from 8.8.8.8: bytes=32 time=231ms TTL=52
Reply from 8.8.8.8: bytes=32 time=51ms TTL=52
Reply from 8.8.8.8: bytes=32 time=77ms TTL=52

Ping statistics for 8.8.8.8:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 51ms, Maximum = 231ms, Average = 114ms

I'm not sure about the time function you mean but basically the *.bat would contain the commands the same way you would issue them in terminal so as an example-- ping.bat ;

@echo off
ping -t 8.8.8.8 > C:\pingy_mac_pingersen.txt

run in terminal including location of *.bat file in command;

c:\ping.bat
1
  • I know this command but in addition I want to print the date and time at the same time. Commented Dec 29, 2015 at 22:12
2

I would strongly suggest for you to move on to Powershell - Powershell contains a cmdlet Test-Connection which will do basically the same thing as ping. Test-Connection is there only from version PS Version 3 onwards, you might need to install additional versions.

Test-Connection google.com | Select IPV4Address, ResponseTime, @{N="Date";E={Get-Date}} | format-Table -autosize | out-file -append testConnection.txt

And the output is as follows:

IPV4Address    ResponseTime Date
-----------    ------------ ----
178.235.206.50           14 2015-12-29 09:35:26
178.235.206.50           16 2015-12-29 09:35:27
178.235.206.50           15 2015-12-29 09:35:28
178.235.206.50           15 2015-12-29 09:35:29
1
  • How about Ping statistics? Commented Aug 23, 2019 at 8:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .