53

I have a command I am running produces a ton of output, I want to silence the output without writing to a file. I have used the following to send all output to a file:

command > out.txt 2>&1

... but again I don't want any file output:

command > /dev/null 2>&1

I have used command > /dev/null on my CentOS box before, but I can't find a similar thing for windows.

2 Answers2

77

You want command > nul 2>&1.

Jed Daniels
  • 7,452
  • 2
  • 37
  • 43
3

You want command > $null 2>&1

nul only works in command prompt whereas $null works in powershell.

ross
  • 3
ZZ9
  • 936