Pipe only stderr....

Sep 1, 2008
32
1
(No, not stdout AND stderr)...

This is a pipe dream... even the *nix shells don't seem to have it.

Too many console apps want to use curses or other random ass code that can't handle stdout being redirected - yet provide data on stderr.

I wish I could pipe ONLY stderr. Or (even better for my usage) capture only stderr to a variable with some new param-kludge to %@exec*.

I have no real suggestion on the syntax since |&| looks kind of crazy - but... I guess it would be unambiguous.

Yes - I can work around this safely (albeit unpleasantly) if there was FILETEMP from my other message.

And yes - I know the world has lived with hacking it's own "%TEMP/__FOO_%RANDOM" in windows for decades... so.. yeah... I guess I will too for now.
 
May 20, 2008
11,867
121
Syracuse, NY, USA
I think you can pipe stderr only. First send stdout somewhere (CON:, file, NUL). Then send stderr to stdout (2>&1). Then pipe. At least that's what I think is happening below.

Code:
v:\> (((echo foo & echoerr bar^r^nfly) 1>con:) 2>&1) | grep bar
foo
bar

v:\> (((echo foo & echoerr bar^r^nfly) 1>stdout.txt) 2>&1) | grep bar
bar

v:\> type stdout.txt
foo
 
Sep 1, 2008
32
1
I think you can pipe stderr only. First send stdout somewhere (CON:, file, NUL). Then send stderr to stdout (2>&1). Then pipe. At least that's what I think is happening below.
Note from original: Too many console apps want to use curses or other random ass code that can't handle stdout being redirected - yet provide data on stderr.

emacs or dialog for example will fall over and die even redirecting stdout to con: :(
 
Jan 19, 2011
614
15
Norman, OK
Code:
0:00:00.002
[C:\temp]
14:56:13 $ (echo stdtest & echoerr errtest) 2>CLIP: & set var=%@CLIP[]
stdtest

0:00:00.017
[C:\temp]
14:56:22 $ echo %var
errtest

EDIT: Yes, I know it's a redirect and not a pipe.