1

I'm trying to figure out how to show only errors on the console output (and suppress all other output) without redirecting to a file or using TEE, etc. I'm trying to get this to work for single commands in addition to calls to functions (CALL :FunctionName arg1 arg2).

I feel like an idiot for not being able to figure this out, but I can't find any examples of this online that I can get to work and none of the combinations of redirections I've used have worked.

How do you redirect STDOUT to >NUL and at the same time redirect STDERR to >CON? Is it just by using >NUL?

It seems like some error messages appear in the STDOUT stream (e.g. SC query BadServiceName) depending on how the console app was written. Is that an accurate assessment?

1 Answer 1

1

How can I redirect STDOUT to NUL and redirect STDERR to CON?

program 1>nul

will redirect stdout to nul. This does not redirect stderr output which should go to the console...

If program also writes errors to stdout then you are out of luck using simple redirections.

See Command Redirection, Pipes - Windows CMD - SS64.com

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .