Windows reserved name “c​on” workaround / hack

我的梦境 提交于 2019-12-10 12:01:35

问题


I understand that "con" is a reserved name in Windows, but is there a registry hack or something that will allow me to use it?

I'm on Windows 7 and trying to unzip a java project containing a file named "con.java". It fails every time.

From what I've learned, "con" is no longer used in Windows 7.


回答1:


You can create files with reserved names by calling the Unicode version of CreateFile (CreateFileW) and prepending \\?\ to the path. From Java you'd probably need JNI or similar to do that, or find a library that does that on your behalf.

However, keep in mind that creating files with names most other applications consider reserved will likely cause interoperability problems.



来源:https://stackoverflow.com/questions/39475219/windows-reserved-name-con-workaround-hack

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