Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Batch Files and Logging  (Read 6254 times)

0 Members and 1 Guest are viewing this topic.

TC

  • Guest
Batch Files and Logging
« on: August 24, 2004, 09:38:51 AM »
Is there any way of writing the output of a batch file as a program runs to a text file? There is no option with the .exe that I am running from the batch for logging. But would like to keep track of what files it finds. These files are written to the screen as the file executes, but I would like to write these to a text file.

Any ideas ???

TC

2k dummy

  • Guest
Re: Batch Files and Logging
« Reply #1 on: August 24, 2004, 10:01:51 AM »
Use redirection.
<command to start program> > <path\filename>
To avoid over writing the original use >>
The double redirection appends the output instead of over writing the original. If you append output, create an empty file with the filename first.

Nik

  • Guest
Re: Batch Files and Logging
« Reply #2 on: September 27, 2004, 08:20:59 PM »
Thankyou thankyou thankyou!

I've been looking for this for over a week now! I was beginning to think it wasn't possible to log the changes...

Yay!

Now, all I have to do is get it to log the date as well... any suggestions / ideas?

Phil Burke

  • Guest
Re: Batch Files and Logging
« Reply #3 on: October 29, 2004, 08:35:19 AM »
I assume you are using Windows or MS-DOS.

I use this to get the date/time into the log files:

date <c:\d\cr.dat | find "current" >>C:\D\PEB\TXT\F_Bak_Log\F_Bak_Log.TXT
time <c:\d\cr.dat | find "current" >>C:\D\PEB\TXT\F_Bak_Log\F_Bak_Log.TXT

HTH,
Phil.