Home Messages Index
[Date Prev][Date Next][Thread Prev][Thread Next]
Author IndexDate IndexThread Index

Re: Batch File Help

  • Subject: Re: Batch File Help
  • From: Roy Schestowitz <newsgroups@xxxxxxxxxxxxxxx>
  • Date: Tue, 20 Sep 2005 06:17:06 +0100
  • Newsgroups: uk.comp.misc
  • Organization: schestowitz.com / MCC / Manchester University
  • References: <1127139422.531544.63350@g47g2000cwa.googlegroups.com> <432f20a3$0$32690$da0feed9@news.zen.co.uk>
  • Reply-to: newsgroups@xxxxxxxxxxxxxxx
  • User-agent: KNode/0.7.2
__/ [Grant Robertson] on Monday 19 September 2005 21:33 \__

> 
> <jakeninetynine@xxxxxxxxxxx> wrote in message
> news:1127139422.531544.63350@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>> Could some kind soul please help me to write a batch file?  I need to
>> automate (by way of a mouse double-click) a tracert to a certain
>> external IP address from an XP machine (on an AD network).  Ideally I
>> would like to time/date-stamp it and save the results of the tracert
>> test to a text file locally on the PC.
>>
>> I have tried - honest - but am now tied up in knots and am having some
>> strange things appearing in my c:\temp directory...!
>>
>> Thanks in advance.
>>
>> jake.
>>
> Open Notepad and paste the following:
> 
> @echo off
> echo======================>>traceroute_logfile.txt
> date /t>>traceroute_logfile.txt
> echo at>>traceroute_logfile.txt
> time /t>>traceroute_logfile.txt
> tracert xxx.xxx.xxx.xxx>>traceroute_logfile.txt
> :exit
> 
> Where xxx.xxx.xxx.xxx is the IP Address of the machine you wish to trace
> to (or use a FQDN)
> 
> Save the file as something like trace.bat (but not tracert.bat or it'll
> get confused when it calls the tracert function!)
> 
> The output file will be produced in the same directory (or you can specify
> a full path like c:\logfiles\tracert.txt)
> 
> HTH
> 
> Grant

Nice one, Grant. If you ever migrate to *nix, here is the equivalent.

tracerootlog.sh containing:

#!/bin/sh

echo echo '==============' >~/traceroute_logfile
date >>~/traceroute_logfile  # includes time on most systems
traceroute >>~/traceroute_logfile

You can then set this up as a cron job, e.g. to be invoked every 5 minutes:

5,10,15,20,25,30,35,40,45,50,55,0 * * * * nice /home/you/tracerootlog.sh

Roy

-- 
Roy S. Schestowitz      | Proprietary cripples communication
http://Schestowitz.com  |    SuSE Linux    |     PGP-Key: 74572E8E
  6:10am  up 25 days 18:24,  3 users,  load average: 0.08, 0.13, 0.22

[Date Prev][Date Next][Thread Prev][Thread Next]
Author IndexDate IndexThread Index