I figured that 2>NUL at the end of DOS commands was enough, but it seems some messages, some error, still get through. So how can I cut off all output whatsoever? Or should I just forget it and allow output through?
2 Answers
Start your batch file with:
@ECHO OFF
And redirect all command output by appending:
>NUL 2>&1
This redirects "Standard Out" (1) to NUL and redirects "Standard Error" (2) to (1).
1The 2>NUL redirection suppresses error output, but has no effect on standard output messages.
The usual way to redirect both is >NUL 2>&1, and you should use this form when redirecting both to a file. However, for the NUL device, you could also use the marginally less efficient >NUL 2>NUL.
See this link for a full description of redirection options.