• Skip to primary navigation
  • Skip to main content
  • Skip to footer

Ulrich's TechLib

Electronic Security Library & Other Oddities

  • HOME
  • BLOG
  • ABOUT
  • PRIVACY POLICY
  • CONTACT
You are here: Home / Networks / Ping to Log File With a Timestamp

Ping to Log File With a Timestamp

Jun 11, 2020 by Ulrich Leave a Comment

Ping with timestamp to a log file

Learn how to ping to a log file with a timestamp to troubleshoot network or device anomalies. This simple Windows batch script is very useful.

Why Would You Want to Ping to Log File With a Timestamp?

The need may arise to ping a device on the network, any device, to test the device or connectivity to the device.

Sometimes device or network problems are not immediately obvious and may require prolonged testing.

The Batch Script

You can download the batch script and modify by editing with notepad or similar. Security policies may prevent you from downloading .bat files. If that is the case just copy the text below and paste into your favourite text-editor, modify and save as .bat to run.

I found the sample on Stack Overflow so I’m not taking credit for it, but since I use it often enough I figured you might too.

@echo off
ping -t 192.168.1.31|cmd /q /v /c "(pause&pause)>nul & for /l %%a in () do (set /p "data=" && echo(!date! !time! !data!)&ping -n 2 localhost>nul" > log.log

In the example above the script will ping the address 192.168.1.31 continuously. It will add date and time stamps and save the output to a file called log.log.

The output file will be saved in the same directory the batch script is run from.

If you found this useful you may also be insterested in 12 CCTV Resources that Actually Add Value.

Share

Share
Share
Tweet

Filed Under: Networks Tagged With: batch script, log, ping, timestamp

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Footer

Get Social

  • Facebook
  • LinkedIn
  • Twitter

Post Tags

acc acc 5 acc 6 acc 7 acc client acc server password alarm anydesk avigilon avigilon directory backup batch script cctv create pop-up google earth internet log lucidchart obs studio onvif device manager password ping pop-up pop-up alarm port-forwarding port forwarding putty server teamviewer timestamp upgrade video analytics vlc

Site Archives

  • Aug 2020
  • Jul 2020
  • Jun 2020

Newsletter

Copyright © 2023 ยท Ulrich's TechLib

Manage Cookie Consent
I use cookies to optimize my website and my service.
Functional Always active
The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
The technical storage or access that is used exclusively for statistical purposes. The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.
Manage options Manage services Manage vendors Read more about these purposes
View preferences
{title} {title} {title}