dev/null => NUL 2>&1
Redirect all output to /dev/null on Windows Command
A lot of Linux code redirects output to /dev/null
as a way of not sending any output to the console. I work in Windows and often use Command Prompt
(cmd.exe) as the command shell. This is just a small note to remember how to do the same in Windows.
Not much here β itβs just:
C:\> ur_command > NUL 2>&1
The > NUL
redirects the stdout to the NUL device (the equivalent of /dev/null
) and the 2>&1
also redirects the stderr to stdout so that nothing is output to the console.
I wrote this up so that I keep it on my mind.