4 ms·
Can somebody more familiar with the Windows environment explain why prn.h is an "invalid file name"? edit:// thanks all! :)
by adrianpike 15y ago
Can somebody more familiar with the Windows environment explain why prn.h is an "invalid file name"?
edit:// thanks all! :)
- manojlds 15y agoprn is for printer and there are many such reserved device names http://en.wikipedia.org/wiki/Device_file#Device_files http://en.wikipedia.org/wiki/Device_file#Device_files
- jharsman 15y agoYou can't have files named like the old DOS devices: CON, LPT, AUX, PRN etc. This is originaly due to CP/M backwards compatibility, it didn't have directories so magic files were udde to pipe stuff to printers and other devices.
- X-Istence 15y agohttps://github.com/antirez/redis/issues/100 https://github.com/antirez/redis/issues/100
- smackfu 15y ago"finally the behavior of the window filesystem is so incredibly broken that well they should really fix it I guess." Ha. Just allow "prn", I'm sure that won't have any side effects.
- kogir 15y agoIt's reserved for compatibility: "Do not use the following reserved device 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."[1] [1] http://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx#naming_conventions http://msdn.microsoft.com/en-us/library/windows/desktop/aa36...
- dugmartin 15y agoI once saw some interesting behavior on a Windows 95 machine - my brother printed a drawing for a convention to a file. The printer was a HP LaserJet with plug in module that enabled Postscript. He named the file "con" and when he hit OK on the print dialog the entire screen buffer (over the windowing interface) started filling with Postscript.
- motti 15y agoWindows tries to prevent you naming a file "con". I once renamed a text file con in Win95; using a raw disk editor to change the file entry and it did this too - every time I saved text in the file it would write it console/DOS style to the screen.
- gresrun 15y agoWe're encountered this issue when dealing with ETF tickers. We use Linux but a 3rd-party redistributor was on Windows; the reports we created had file names in the form <TICKER>.pdf and, what would you know, PRN.pdf caused all sorts of trouble for them...
- rbanffy 15y agoPC-DOS inherited it from CP/M 80. Windows was built at first on top of it and then replaced it in stages. I have no idea why would this still be present in the current codebase. It would probably be easier just to fix the filesystem.
- plorkyeran 15y agoThere's countless batch files that rely on NUL (including with extensions, usually because some other batch file is appending the extension). Most of the other ones could probably be safely removed, but it would still run contrary to Microsoft's policy of not breaking backwards compatibility unless absolutely necessary.