Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Name: Judago
Does anyone have any info on the fourth data stream(for lack of a better name) for cmd?
I'm using XP home sp3 with all the latest updates and stumbled across something interesting, perhaps even a bug in cmd. The following cmd causes a loop on the command line with the current directory prompt being drawn to screen repeatedly, <ctrl>+<c> doesn't stop it:
cmd<nul 3>nulAnother interesting thing about this is that it doesn't seem to work from a batch unless the batch is invoked from the command line.
By the fourth data stream I mean:
0=standard in
1=standard out
2=standard error
3=?? this one
I did contemplate that it may be some sort of loop back but can't seem to get it to do anything else. Any information is appreciated.

I don't know the answer, but I found that it doesn't have to be cmd: the command line can invoke any other program. Also, it has to be in the form programname <nul 3>nul. The following will show the bug:
notepad <nul 3>nul
type nul <nul 3>nulThe following will NOT show the bug:
notepad 3>nul <nul
type nul <nul 4>nulVery strange behaviour.

Yes very strange, I've found other variations as well, nul doesn't have to be involved at all.
cmd<file.txt 3>&1Another strange thing about it is if you turn echo off first it only displays one prompt as per normal, but there is no control and cmd has high cpu consumption. It "seems" to be using stdout to display the prompts(it will be whatever your prompt is, even custom prompts). So con and stderr don't seem to be involved.....

![]() |
help with awk - sed
|
batch file programming
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |