The null device is a special file that discards all data written to it, but reports that the write operation succeeded.

Nul is often used to hide the output (or error output) of a command.
It is called NUL rather than NULL for historical reasons, many other devices have 3 character names: AUX, PRN, CON, etc.
It's not possible to create a file named "nul" on Windows.


SomeCommand >nul

Nul provides no data to any process that reads from it, yielding EOF immediately.

Nul is dependent on the Null Service, a kernel device driver (CurrentControlSet\Services\Null).

For more examples see the redirection page.

“Never mistake activity for achievement.” ~ John Wooden

Related commands

BREAK - Do nothing, successfully.
PRN - redirect to the printer LPT1.
Equivalent PowerShell: $Null

Copyright © 1999-2024
Some rights reserved