in reply to Re: Filtering output from a system() call
in thread Filtering output from a system() call

The same syntax will work under Win32, the only difference being the name of the bit-bucket. Ie. nul

It's worth pointing out that to redirect both handles you can do, mycommand 1>nul 2>nul or mycommand 1>nul 2>&1 or mycommand  2>nul 1>&2

but that mycommand 1>&2 2>nul doesn't work as the first part redirects handle 1 (STDOUT) to wherever handle 2 is currently pointing (which is the same place as STDOUT at that point). The subsequent redirection of handle 2 to the nul device only redirects handle 2 and does not retro-actively re-redirect handle 1.

I point this out only because I still get this wrong if I'm doing stuff in a hurry, and I've been doing so for 10+ years.


Examine what is said, not who speaks.

The 7th Rule of perl club is -- pearl clubs are easily damaged. Use a diamond club instead.