Navigation

7/17/2013

To supress output from batch file

Want to eliminate output/error messages from .bat file:


Direct STDOUT to null. Errors will still be displayed. As an example, run dir badfile.txt >nul and you will still see “File not found” displayed. That’s because errors are written to STDERR

To redirect STDERR to nul as well, try this:
dir badfile.txt > nul 2>&1

Of course you may want to see the errors. So a better tack to take could be to write to a log file
dir badfile.txt >log.txt 2>&1



From  http://www.windowsreference.com/windows-xp/how-to-supress-prompts-responses-from-commands-in-batch-files/

No comments:

Post a Comment