Subj : Re: redirection of stdout. To : Winston.Smith@xspamp0.f120.n323.z1. From : Charles Dye Date : Mon Mar 25 2002 02:42 am From: Charles.Dye@f3.n342.z1.cereal.mv.com (Charles Dye) Subject: Re: redirection of stdout. From: raster@highfiber.com (Charles Dye) On Mon, 25 Mar 2002 00:01:06 GMT, Winston.Smith@xspamp0.f120.n323.z1.fidonet.org wrote: >>> (4dos/msdos:) is there a way (using 4dos) to detect from inside a >>> batch file if stdout has been redirected (to a file/pipe). > >WS> Under MS-DOS using a pipe creates a temporary file in your >WS> designated temporary directory that uses three dollar/currency >WS> signs as a naming convention. It would be fairly easy to scan for >WS> that. > >-> so how do I access the name? > >I believe it is :.$$$ > for example, > C:\TMP\*.$$$ > or > C:\WINDOWS\TEMP\*.$$$ > >...but I haven't tried to crash MS-DOS I/O in a while, now. You can see the filenames created by a pipe with: dir /a /od %temp | list The temporary file created by the pipe will be the last one listed. On *my* system, these files end in .000 not .$$$. I do not know whether there is any circumstance where 4DOS would use .$$$, or a different numeric suffix such as ..002. Current versions of COMMAND.COM create temporary files with no extension at all. At any rate, the presence of such a file doesn't necessarily tell you anything about the state of the current shell. A .000 file *might* indicate that the current shell is emulating a pipe. Or it might be a different shell in a separate DOS box, or a temp file left over from a system crash last Thursday, or a temp file created by some other program.... -- Charles Dye raster@highfiber.com -- |Fidonet: Charles Dye 1:342/3 | | Origin: The Cereal Port BBS (603)899-3335 199.125.78.133 (1:132/152) --- # Origin: (1:132/152.4) * Origin: Baddog BBS (1:218/903) .