Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!im4u!jai From: jai@im4u.UUCP Newsgroups: comp.sys.ibm.pc Subject: Re-directing the output of commands in a BAT file Message-ID: <1837@im4u.UUCP> Date: Sat, 16-May-87 13:49:50 EDT Article-I.D.: im4u.1837 Posted: Sat May 16 13:49:50 1987 Date-Received: Sat, 16-May-87 21:45:48 EDT Reply-To: jai@im4u.UUCP (Jai Srinivasan) Distribution: world Organization: U. Texas CS Dept., Austin, Texas Lines: 25 Some time back there was a query about how to re-direct the output of every command in a BAT file to another file. (I didn't save the original article and can't find it in the news directory now - sorry.) If the file is FOO.BAT then the command "foo > foo.out" does not re-direct the output of the commands in foo. To do that give the command: command /c foo > foo.out Now the original command processor spawns a child command processor which runs FOO.BAT as its sole task and exits. The original command processor ensures that the output of the child command processor (and all its children) are re-directed. Note that the child command processor (on DOS 3.1 at least) does not have as large an environment as the original, so if the file FOO.BAT sets a lot of new environment variables, it will run out of environment space. Also this re-directs only standard output, not standard error: nothing from the DOS command line can help re-direct standard error. Jai. ----------------- Jai Srinivasan, UUCP: {gatech,harvard,ihnp4,pyramid,seismo}!ut-sally!im4u!jai ARPA: jai@im4u.UTEXAS.EDU, jai@sally.UTEXAS.EDU