delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/09/27/12:34:10

From: Hans-Bernhard Broeker <broeker AT physik DOT rwth-aachen DOT de>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: get output of commands in batch file redirected to a file
Date: 27 Sep 2001 16:25:04 GMT
Organization: Aachen University of Technology (RWTH)
Lines: 21
Message-ID: <9ovjt0$1vs$1@nets3.rz.RWTH-Aachen.DE>
References: <Pine DOT OSF DOT 4 DOT 21 DOT 0109270943020 DOT 5453-100000 AT esus DOT cs DOT montana DOT edu>
NNTP-Posting-Host: acp3bf.physik.rwth-aachen.de
X-Trace: nets3.rz.RWTH-Aachen.DE 1001607904 2044 137.226.32.75 (27 Sep 2001 16:25:04 GMT)
X-Complaints-To: abuse AT rwth-aachen DOT de
NNTP-Posting-Date: 27 Sep 2001 16:25:04 GMT
Originator: broeker@
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Paula Sanchez <psanchez AT cs DOT montana DOT edu> wrote:

> I am using DOS 7.10 and I have some batch files that I am not supposed to
> modify its content (I am not allow to redirect the output of each command
> in the batch file).  I need to redirect the output of all the commands to
> a file from the calling command line.  

The problem is that batch files are executed by the current instance
of command.com. So no new program is started, and thus the redirection
operation doesn't work.

The workaround is to start your batchfile in an explicitly called, fresh
command.com, like this:

	command.com /c batchfile > output

Or compile it using bat2exe :-)

-- 
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019