In the realm of Windows 11, a peculiar naming convention persists, harking back to the days of DOS. Users may find themselves perplexed when attempting to name a folder CON, only to be met with an unwavering refusal from File Explorer. This restriction is not merely a quirk of modern computing; it is a legacy that dates back to the very inception of DOS 1.0, a time when folders were nonexistent.
CON, PRN, AUX and NUL are devices, not file names, in Windows 11
Each of these reserved names corresponds to a specific device, with NUL being particularly intriguing—a virtual black hole that consumes any output directed towards it. The following table outlines these reserved names and their respective functions:
| Reserved name | What it points to |
|---|---|
| CON | Console (keyboard and screen) |
| PRN | Printer |
| AUX | Auxiliary device |
| NUL | Null device (discards output) |
| COM1 to COM9 | Serial ports |
| LPT1 to LPT9 | Parallel (printer) ports |
According to Microsoft’s documentation, developers are cautioned against using these reserved names for files, a rule that extends to folders as well. This is because Windows treats folders as a unique type of file.
Interestingly, adding an extension to these names does not typically circumvent the restriction. Microsoft clarifies that NUL.txt and NUL.tar.gz are still equivalent to NUL. Even the use of superscript digits does not exempt names like COM¹ or LPT³ from being reserved across all directories. This is rooted in the architecture of Windows, where COM1 directly links to a serial port within the kernel, allowing access to the port rather than a file.
Raymond Chen explains why a DOS 1.0 rule is still active in Windows 11
The origins of this naming convention can be traced back to CP/M, the operating system that MS-DOS sought to emulate. In CP/M, device names were always followed by a colon, such as CON:. MS-DOS simplified this by making the colon optional, leading to ambiguity—without it, DOS could not discern whether a name referred to a file or a device.
In a 2003 blog post, Microsoft engineer Raymond Chen elaborated on how DOS 1.0 lacked support for subdirectories, lowercase letters, or filenames exceeding the 8.3 character limit. This historical context explains why some of Windows 11’s oldest system files retain their DOS-era names. In the early days, if an assembler required a printout, one would simply type PRN as the filename, while NUL would discard any output, and CON would display it on the screen.
With the introduction of folders in DOS 2.0, Microsoft decided to maintain the functionality of these names across all directories to ensure that users could still utilize them effectively. This decision has resulted in the enduring prohibition against naming files or folders with these reserved names, even in modern iterations of Windows.
Despite the passage of over four decades, Microsoft has refrained from altering this naming convention. Chen notes, “Because everybody still relies on them,” as batch files and scripts continue to use these names for various functions. The removal of these rules could disrupt countless legacy scripts, which depend on the established naming conventions.
I tried the DOS-era rule on Windows 11 26H2, and NUL.txt slipped through
In a recent test on a Windows 11 26H2 system, attempts to rename a folder to CON resulted in an error message stating, “The specified device name is invalid.” Similar outcomes occurred with PRN, AUX, NUL, and COM1. However, intriguingly, NUL.txt and CON.txt were created without issue, despite Microsoft’s assertion that NUL.txt is equivalent to NUL.
This discrepancy suggests that while Microsoft’s documentation remains unchanged, the underlying system has evolved. Developers exploring Python’s Windows support noted that Windows 11 has ceased treating device names with extensions as special, leading to unpredictable behavior with such files. For instance, PowerShell could list NUL.txt but was unable to open or delete it, raising concerns about the reliability of these files.
For those curious about the historical significance, using Command Prompt still reveals the old DOS magic: executing echo hello > CON displays “hello” on the screen, while echo test > COM¹ fails, adhering to the established documentation.
As a side note, in 2024, Linux maintainers renamed a graphics driver file from aux.c to auxch.c to avoid conflicts when cloning the Linux kernel on Windows. This raises an interesting point of comparison: while Linux adapts its code for compatibility, Windows remains tethered to a naming convention that has persisted for over four decades, highlighting the complexities of legacy systems in modern computing.
While Windows 11 has relaxed certain rules enough to permit NUL.txt, the name CON remains firmly categorized as a device, not a file name. This enduring legacy serves as a reminder of the intricate history that shapes our current technological landscape.