NUL is a special, reserved file name. NUL is the data sink character device under MS-DOS and related operating systems, including all forms of Windows.

What this is means is that NUL behaves in some ways like a file, but isn't. In particular, data may be written to and read from NUL, but NUL may not be deleted, created, or renamed. Because of the semantics of character devices, all files whose base name is NUL, regardless of extension, are treated identically to NUL.

Because of NUL's status as a data sink, all data written to it will be ignored. Attempts to read data from it will succeed, but no data will be returned.

Some programs are vaguely aware of the special status of NUL and other character devices. For example, attempting to open NUL with Windows Notepad yields the not-terribly-helpful error message "Incorrect function." Attempts to rename a file or directory to NUL using the Windows Explorer will indicate that such a file already exists. Whereas, the MS-DOS Editor will open NUL correctly.

NUL is useful in batch files because program output can be redirected to it. This has the result that the output of that program is discarded. This may be desirable to suppress an expected error message (although only standard output will be redirected, not standard error). For example:

DIR > NUL

NUL is equivelent to /dev/null on Unix systems.

See here for more information on this subject.