Article View: alt.msdos.programmer
Article #1296Redirecting output of DOS batch files
From: Floyd Miller
Date: Fri, 02 Mar 1990 22:57
Date: Fri, 02 Mar 1990 22:57
38 lines
1767 bytes
1767 bytes
I have a few batch files that run pipelined programs,
searching for a pattern, extracting fields and sorting.
They make life a bit easier by elliminating the need
to retype long command lines.
However, sometimes I want to run the final output through
a pager (like "more") or save the results in a file.
I try to run: filter.bat | more
More doesn't do anything.
So I try: filter.bat > f.out
f.out gets created with no data while the output
of filter.bat comes pouring out on my screen.
Apparently, REDIRECTING DOESN'T WORK ON BATCH FILES.
I was surprised mostly by the fact that it took up until
now for me to discover this deficiency in DOS.
I think that a program which overlays stderr onto stdout
and then invokes the batch file would allow redirection
of the batch file output. Then you would run the batch
file as:
redir prog.bat
or redir prog.bat > file.out
or redir prog.bat | more
I will try this. And, if there is interest I'll post
"redir" if it works. But is there an easier way?
Perhaps without having to use a separate program to
invoke the batch file?
******* *****************************************
***** ************************* Floyd Miller
*** *************** floyd@starsend.UUCP
* ********* floyd%starsend@PRC.Unisys.com
*** starsend!floyd@burdvax.PRC.Unisys.com
*
Technical Details
Message-ID:
<0019@starsend.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!mailrus!ames!haven!udel!burdvax!starsend!floydShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!mailrus!ames!haven!udel!burdvax!starsend!floyd From: floyd@starsend.UUCP (Floyd Miller) Newsgroups: alt.msdos.programmer,comp.sys.ibm.pc.programmer Subject: Redirecting output of DOS batch files Message-ID: <0019@starsend.UUCP> Date: 2 Mar 90 22:57:35 GMT Followup-To: alt.msdos.programmer Organization: Woodward McCoach, Inc. Lines: 38