46

If I want to ignore stdout of a command, I do this on *nix:

myprog > /dev/null

How do I achieve the same on Windows (in cmd or a batch file)?

2

2 Answers 2

67

Use NUL:

myprog > NUL
-1

Just tried myprog > NUL on my Windows console, doesn't work. Should be myprog>NUL (no space characters) e.g. npm i>NUL works.

2
  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Apr 13, 2023 at 12:42
  • 1
    It works for me, with or without spaces. Apr 13, 2023 at 12:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .