0

Okay so, I'm pretty sure I'm not just being silly about this, but >nul is not hiding the entire output, and I'm curious as to why, and if there is a solution:

net stop "service here" >nul

See, if it fails, then it outputs said failure, but I want to hide ALL output period, how can I do that?

Atma
  • 3
  • 2
  • not a batch expert, but does `2>NUL` make a difference? Try appending it to the command, like `>NUL 2>NUL` – tay10r Sep 08 '14 at 03:36
  • @TaylorFlores: Best make that an answer - likely it's correct, but there are a few commands that write to the screen regardless of redirection... – Magoo Sep 08 '14 at 03:47

1 Answers1

3

To redirect all output to nul, you have to use >nul 2>nul.

Why? There are two output handles: stdout and stderr, the latter is used for error messages. 2 is just the number associate with the file handle of stderr (for stdout, this number is 1).

tay10r
  • 4,234
  • 2
  • 24
  • 44