Click to See Complete Forum and Search --> : Simple DOS batch question
Annorax
September 29th, 2005, 09:14 AM
Hi,
I know how to send the screen output to a file via >>, but is there a way to have the output sent to BOTH the screen and a file?
Thanks for any help.
PeejAvery
September 29th, 2005, 11:53 AM
Don't use "@echo off" and it will output to the screen. Use "> filename.txt" to output to the text file.
Annorax
September 29th, 2005, 01:16 PM
I'm calling an ant command that I want the output sent to a log file and to the screen. Echoing left on will only show the command itself, not it's output.
Shuja Ali
September 29th, 2005, 01:49 PM
I remember doing things like this, if i didn't want the output of a certain command shown on the screen, i would just redirect it to a log file.. An example follows
type this at command prompt
Dir > FolderList.TXT
this will create a file "FolderList.TXt" and will save the output of Dir command into this file. And there won't be any output shown on the screen.
PeejAvery
September 29th, 2005, 01:53 PM
Look at my previous post.
Use "> filename.txt" to output to the text file.
Shuja Ali
September 29th, 2005, 02:08 PM
Look at my previous post.
Oops, I just missed it. Sorry about that
Annorax
September 29th, 2005, 02:27 PM
I remember doing things like this, if i didn't want the output of a certain command shown on the screen, i would just redirect it to a log file.. An example follows
type this at command prompt
Dir > FolderList.TXT
this will create a file "FolderList.TXt" and will save the output of Dir command into this file. And there won't be any output shown on the screen.
But I want output on BOTH the screen AND the logfile. I already know how to redirect to a file.
I guess this question isn't so easy...
Shuja Ali
September 29th, 2005, 02:39 PM
But I want output on BOTH the screen AND the logfile. I already know how to redirect to a file.
I guess this question isn't so easy...If it is not easy, then we'll try to do a work around. First save the output of the command in to the file and then once the command finishes type the file on the screen..
@Echo Off
Dir > FileList.txt
Type FileList.txt
PeejAvery
September 29th, 2005, 03:35 PM
Okay, I wasn't following what you meant, Annorax.
Annorax
September 30th, 2005, 09:02 AM
It seems the only way to do this is to use type. I was hoping to just find a way to output to both screen and file simultaneously, but that doesn't seem to be possible. Ideally I would like it to print to screen as it executes the ant script, but it seems the only thing I can do is have it print to screen after it finishes.
PeejAvery
September 30th, 2005, 10:48 AM
It seems the only way to do this is to use type. I was hoping to just find a way to output to both screen and file simultaneously...
Not in just plain DOS. You could do it in QuickBasic. Very simple language.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.