in reply to Open a second DOS window
It is possible to accomplish what you want, but not straightforwardly. The problem is that DOS does not have any such concept as STDERR, at least not in anything like the Unix sense of that term.
Traditionally, DOS software does not print error messages to the console unless they are fatal and the program is bailing back out to the prompt immediately, in which case there was (think DOS here, not a command box window on Windows, which is intended as a compatibility measure only) no point whatsoever in being able to redirect that output, since it would typically be one sentence long and the user would be getting a prompt. (Remember that DOS was not intended to be Unix, to run on university computers where people were developing software and doing research; it was intended to sell to businesses for things like spreadsheets.) For more verbose error messages in the DOS world, you either explain it onscreen in a fashion that is integrated with the rest of your app (think: text-based dialog box) or else you write it to a log file. For these hysterical raisins, DOS did not have a redirectable STDERR, which leads to your current problem. All C libraries for DOS and for Windows face this issue: do we want to support compiling Unix software that assumes it can just write willy nilly to STDERR, and if so how? The usual approach is to make STDERR synonymous with the console, which is IMO absolutely the wrong way to do it. (What the C libraries probably should have done, back in the eighties, is point it to C:\STDERR.LOG, but it's far too late for that now. What C libraries IMO should be fixed to do now is show these messages in a window available by clicking an icon in the system tray -- but nobody listens to me.) What just about all C libraries do, as I said, is map it to the non-redirectable console. (The console is not by its nature intended to be redirectable; it is not in any sense a stream. The BIOS calls that most C libraries use for writing to it can just as well be used to draw text-based pulldown menus and dialog boxes; they support absolute positioning and that sort of jazz, rather more like ncurses than STDERR on Unix.) As a result, the C library's standard error stream is largely useless on DOS -- and also on Win32 by extension. My advice is, don't use it, in Perl or any other language, if your code needs to support Windows.
However, Windows 95 and later come with some facilities like multitasking that will allow you to fake it, particularly since in Perl it is possible to close off STDERR and open it pointing to something else (something _other_ than the C library's concept of STDERR), such as a pipe or log file. This is what you should do.
$;=sub{$/};@;=map{my($a,$b)=($_,$;);$;=sub{$a.$b->()}} split//,".rekcah lreP rehtona tsuJ";$\=$ ;->();print$/
|
|---|