Delete a file named NUL on Windows
So…here we are. You were probably using stuff ported from a UNIX-like system and managed to create a file called NUL on a Windows system.
A file name that’s special on Windows and that can’t be deleted.
Well…this is awkward.
Fortunately, the solution is a command prompt command away. You’ll need to know the full path to the file. Open a command prompt (an elevated one if necessary) and instead of something like “del C:\Windows.old\Temp\NUL”, type this:
rename \\.\C:\Windows.old\Temp\NUL file.txt del file.txt
NUL file is gone! That was easy.