Windows reserved filenames




















Under Window the length of a full path under both systems is characters. In addition to these characters, the following conventions are also illegal: Placing a space at the end of the name Placing a period at the end of the name The following file names are also reserved under Windows: aux , com1 , com2 , Improve this answer. Jabberwocky Jacob T. Nielsen Jacob T. Nielsen 2, 6 6 gold badges 25 25 silver badges 30 30 bronze badges. I find the legitimacy of that article questionable, because it states that on Mac OS X, "File and folder names are not permitted to begin with a dot '.

It's not just the filenames you reserved under Windows, it's any of those device names followed by any extension whatsoever, e. Adam Rosenfield Adam Rosenfield k 95 95 gold badges silver badges bronze badges. A tricky Unix gotcha when you don't know: Files which start with - or -- are legal but a pain in the butt to work with, as many command line tools think you are providing options to them.

Many of those tools have a special marker "--" to signal the end of the options: gzip -9vf -- -mydashedfilename. Malvineous Malvineous I tried deleting the created file again, but del freezes in command line Edit: I cant event kill cmd with task manager or process hacker Works fine for me.

You can't del COM1 because of course that will try to access the serial port instead of the file and cause the process to lock up, waiting for a response from the serial port itself exactly the reason why filenames like this are reserved and unavailable for use in the first place. I just wonder why my cmd froze. I gave up and reinstalled my complete OS.

That fixed it pretty fast. Maybe you didn't put quotes around it or made a typo? Reinstalling is a bit overkill, a reboot would have fixed the problem! Trent Trent James Curran James Curran Ran into this nonsense today. I think it's so programs like LINK. In Windows operating system environments, there exist forbidden file names that cannot be used to name files, and also certain characters that cannot be used in filenames. The following are case insensitive reserved names which cannot be assigned to a directory or file in Windows:.

The following are special characters which cannot be used in a directory or file names in Windows:. The reserved names mentioned above cannot be used to name a file or directory. Thinking about this further, it might be better to make this stripping out optional, perhaps using the options passed in.

What do you think? For the benefit of non-Windows users? I've thought about this too, because different operating systems and different filesystems have different rules about what is a valid filename. We could let the user pass in a "target" system e. That said, I think the default behavior should still be to sanitize against all systems. It seems like a safe default for users that don't bother to look at the options.

It also handles the common use case of naming files that will be shared across systems e. Yes, I agree that we should let the targets be configurable, though perhaps we could go with an object instead of a string, something like:. Which would allow someone to sanitize against more than one target. And I agree that the default should be true for all targets. I like it.

I'm going to open an issue for this functionality so the idea doesn't get lost in this closed issue. Skip to content.



0コメント

  • 1000 / 1000