Search code examples
windowsbatch-filecmdnul

How does nul work when a file called nul exists


If nul can never be a file in Windows, what if it a file called "nul" was created in all the directorys using a OS that doesn't have the same rules for nul. Would data be written to nul if for example 'echo 1234>nul' was performed in CMD or would it be discarded?


Solution

  • Nul is not a reference to a file, it is part of Windows and when >nul is performed, it isn't writing it the the file nul, but instead it's just being ignored