Is there a way to redirect Windows console commands to nothing\null?

A regular redirection might look like:

prog.exe > a.txt

However in my case I would like to redirect the output so that it will not be written or displayed anywhere.

1 Answer 1



This directs standard output to nul:

prog.exe >nul

This directs errors to nul:

prog.exe 2>nul

This directs both to nul:

prog.exe >nul 2>nul
  • snazzy. this should let me clean up those scripts where i generate a temporary text file to hide output cause i didn't know better ;)
    – Journeyman Geek
    Oct 17, 2011 at 0:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.