Cannot create a directory named “Aux” or starting by “Aux.” on Windows 8.1

走远了吗. 提交于 2019-12-22 07:06:29

问题


I just encountered a really weird bug on Windows 8.1.

I can't seem to be able to create a folder named Aux or starting by Aux.. I tried on every disk, but I get the following message every time: Le nom du périphérique spécifié n'est pas valide (The name of the specified device is invalid).

Why is that? Is there a specific/valid reason? Is it specific to my computer?


I discovered this because I programatically created a folder named Aux and I can't delete it anymore. I guess I have to run a script or program to get rid of it. (As it usually happens with such scenario on Windows)


回答1:


aux, prn, and con (among some others) are reserved for legacy reasons. prn refers to the printer, for instance, and con refers to the standard keyboard (console). It's a remnant of MS-DOS retained for compatibility reasons, I'd guess.

You can still see con in use at a command prompt: type copy con test.txt in a folder where you have write access, type some text, and hit F6 to commit to disk, and then type test.txt to display what you typed on the screen.

There's a bunch of information in Naming Files, Paths and Namespaces (Windows) - for the parts that are relevant to your question, see the section with the bullet points, specifically this item:

  • Do not use the following reserved names for the name of a file:

    CON, PRN, AUX, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, and LPT9. Also avoid these names followed immediately by an extension; for example, NUL.txt is not recommended. For more information, see Namespaces.



来源:https://stackoverflow.com/questions/36225708/cannot-create-a-directory-named-aux-or-starting-by-aux-on-windows-8-1

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!