WHAT'S NEW?
Loading...

Batch Script to Redirect ping Results to a file

Once I had to log the ping request from a server to another server for about one week continuously and analyze the log records. How could I? I thought Batch Script can be help me as I had the concept of how batch script works. Got solution! I was able to log the records from Batch script in a text file. I processed the file using Java and I was able to get the desired range of ping request response time in the form of a report. Programming is just amazing. I could analyze a week long log record. And batch script automated my job of logging ping request response.

@ECHO OFF
SET IP=192.168.10.25
SET INTERVAL=30
:PINGINTERVAL
ping %IP% -n 1 >> ping_log.txt
timeout %INTERVAL%
GOTO PINGINTERVAL



Here 192.168.10.25 is the remote IP and can be replaced by any domain name. INTERVAL variable is the time interval(in seconds) between the execution of ping command. ping_log.txt file is the log file that is created in the working directory of the command prompt in windows.

0 comments:

Post a Comment