问题
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