00 Votes

Windows: Why is it not possible to create the file "nul.txt"?

Question by Larosso | Last update on 2022-12-30 | Created on 2017-05-16

I have tried to create a file named "nul.txt" today. Strangely, this is not working and I always get the meaningless error message "The specified device name is invalid" when trying to rename an existing file to this name. My operating system is Windows.

Can someone explain this behavior? And what does a file have to do with a device or a device name?

ReplyPositiveNegative
1Best Answer1 Vote

The name "NUL" is (like some other names) a reserved word for a device on Windows so that filenames with "NUL" are not allowed.

The file extension as well as uppercase and lowercase writing are not playing any role: nul.txt is not allowed like nul.doc, nul.x or any other combination.

Because this issue is a bit more complex, I have created an info describing why the names con, aux, nul, com1 or lpt1 cannot be used as file or folder names on Windows. If you want, you can learn more about this topic there.
Last update on 2022-12-30 | Created on 2017-05-16

ReplyPositive Negative
Reply

Related Topics

Rename File to its Folder Name

Tutorial | 0 Comments

PHP: File Download Script

Tutorial | 0 Comments

Important Note

Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.

Participate

Ask your own question or write your own article on askingbox.com. That’s how it’s done.