People at various times run into mysterious problems that have no apparent source but are eventually found out to be caused by the innocent use of a file named "aux.txt" or any one of the other reserved file names. It isn't realistic to expect that all users of such an ubiquitous system as Windows would learn about this technical limitation and remember what the reserved file names are. Is there any reason why the Windows file system does not check for this in order to either forbid these names, or at least issue a warning to the user when their presence is detected? The system knows what names are forbidden, users do not.
📎 AI Summary:
The thread discusses issues related to creating files with reserved or problematic names, such as "aux," in Windows, with users noticing inconsistencies across different applications like Windows Explorer and VS Code. The participants explore whether the underlying Windows file system checks for these reserved names and note that while Explorer enforces some restrictions, other programs like VS Code sometimes allow such names, leading to potential errors. Overall, the conversation highlights concerns about the lack of comprehensive, system-level enforcement for reserved filenames, and users consider reporting these inconsistencies to Microsoft.
The thread discusses issues related to creating files with reserved or problematic names, such as "aux," in Windows, with users noticing inconsistencies across different applications like Windows Explorer and VS Code. The participants explore whether the underlying Windows file system checks for these reserved names and note that while Explorer enforces some restrictions, other programs like VS Code sometimes allow such names, leading to potential errors. Overall, the conversation highlights concerns about the lack of comprehensive, system-level enforcement for reserved filenames, and users consider reporting these inconsistencies to Microsoft.
Solution
Windows Explorer checks for that, but that's only one particular app which is written to do so, it's not the underlying file system. Others, for example Microsoft Studio Code which happens to be in front of me right now, let me create source files with forbidden names. This program is not explicitly designed to handle the file system and it doesn't know to check for this. We can't expect all application software to do so. But if the name check was in the underlying file system itself instead of a higher layer of one program (maybe more, I don't know) then it would prevent the problem at large. Reality is, files are created, renamed, imported in various ways, and the system accepts them.
Member details
- Joined
- Jul 4, 2015
- Messages
- 8,995
Windows does generate an error basically that the file/directory name is invalid. These reserved words date back to DOS and still are used with in batch files which is why they haven't been removed.
Windows Explorer checks for that, but that's only one particular app which is written to do so, it's not the underlying file system. Others, for example Microsoft Studio Code which happens to be in front of me right now, let me create source files with forbidden names. This program is not explicitly designed to handle the file system and it doesn't know to check for this. We can't expect all application software to do so. But if the name check was in the underlying file system itself instead of a higher layer of one program (maybe more, I don't know) then it would prevent the problem at large. Reality is, files are created, renamed, imported in various ways, and the system accepts them.
Member details
- Joined
- Jul 4, 2015
- Messages
- 8,995
Tested explorer, cmd and VS code none of them let me create those files. They should all ultimately call into ntdll.dll and then into kernel mode I couldn't tell you where the check is but it's most likely in ntdll.dll or the kernel itself.
Tested from the SYSTEM account as well and still not able to make reserved files.
Tested from the SYSTEM account as well and still not able to make reserved files.
VS Code prevents it for you? For me (version 1.28.0) it lets me name a source file aux.rs, which leads to compilation errors. If I try to name it aux?.rs however an error message is generated:
"The name aux?.rs is not valid as a file or folder name. Please chose a different name."
...and the file is renamed auxÉ.rs instead to avoid the problem. If I try to name it aux.rs then there is no warning and the name is accepted without change. Forbidden file names due to invalid characters are treated different than forbidden file names.
"The name aux?.rs is not valid as a file or folder name. Please chose a different name."
...and the file is renamed auxÉ.rs instead to avoid the problem. If I try to name it aux.rs then there is no warning and the name is accepted without change. Forbidden file names due to invalid characters are treated different than forbidden file names.
Yes, it was the result of attempting to rename aux.rs to aux?.rs: the illegal question mark was replaced with a legal unicode character.
I am now trying to reproduce it but without success, the new name with its illegal character is simply rejected and the former name is restored. But I can rename it to other illegal file names such as con.rs, com2.rs and so on.
I am now trying to reproduce it but without success, the new name with its illegal character is simply rejected and the former name is restored. But I can rename it to other illegal file names such as con.rs, com2.rs and so on.