Ping with timestamp

How cool is that

ping command with timestamp in a text file

I needed to run a ping with timestamp, but the ping command isn’t capable of such fancy features.

A lot of people found various solutions with sometimes astoundingly complex scripts. I usually like batch files, but found it to be too cumbersome for this simple need. In the end, I found this PowerShell command to be the easiest solution for me.

ping -t localhost|Foreach{"{0} - {1}" -f (Get-Date),$_} | Out-File log0.log

While PowerShell runs the command no output is visible.

This is fine with me because I simply open the file in Notepad++ and use the monitoring (tail -f) option from the View menu.

The result is very usable for me.