-2

I found an answer for creating a batch file for continuous pinging:

How can I perform a ping every X minutes and check the response time?

But, I need to include a time and date stamp in the output log.

Would someone help me complete the batch file, please?

@ECHO OFF
set IPADDRESS=x.x.x.x
set INTERVAL=60
:PINGINTERVAL
ping %IPADDRESS% -n 1 >> filename.txt
timeout %INTERVAL%
GOTO PINGINTERVAL
J_A
  • 21

1 Answers1

2

To set up a log file and provide a time stamp Need to set a log variable

First up set up log variable and {Setlocal keeps the set command from being permanent }

  • Setlocal
  • Set LOG=\MyServer\Share\MyFolder\Install_Xyz.log

To send something to the log use >>%LOG%

  • echo . >>%LOG%
  • echo Start of install of XYZ >>%LOG%

to send a time or date stamp use the /T switch to get the bare time output

  • Time /T >>%LOG%
  • Date /T >>%LOG%
bvaughn
  • 751