|
Answer» Gurus,
I need help adding a date/time stamp with a LOG file.
I have a batch file that executes every five minutes & appends the information in a log file.
EXAMPLE: netstat >>c:\netstat.log
Active Connections
Proto Local ADDRESS Foreign Address State TCP phhoracorp1:1037 corpjbapp2.phhcorp.com:36516 ESTABLISHED TCP phhoracorp1:1046 corpjbweb2.phhcorp.com:48913 ESTABLISHED TCP phhoracorp1:1051 corpcms1.phhcorp.com:47981 ESTABLISHED TCP phhoracorp1:1053 corpcms1.phhcorp.com:47983 ESTABLISHED TCP phhoracorp1:1061 phhlttablet1:3758 ESTABLISHED
Is there a way to add a date/timestamp within this file everytime the command executes?
This may work for you. Without mentioning a OS it's hard to tell:
Code: [SELECT]@echo off for /f "delims=" %%i in ('netstat') do ( echo %date% %time% %%i >> c:\netstat.log )
Good luck. 8-)That worked! Thanks a LOT!
|