Atma
Atma

Reputation: 3

>nul wont hide output batch

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?

Upvotes: 0

Views: 534

Answers (1)

tay10r
tay10r

Reputation: 4357

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).

Upvotes: 3

Related Questions