Interesting bit on long filenames in DOS
- Posted by DB James <larch at adelphia.net> Aug 12, 2005
- 459 views
Hi all, I have been messsing about on my WinXP machine looking possible ways to work around the problem described in the Eu documentation: <Quoted material> DOS32: When running under Windows 95 or later, you can open any existing file that has a long file or directory name in its path (i.e. greater than the standard DOS 8.3 format) using any open mode - read, write etc. However, if you try to create a new file (open with "w" or "a" and the file does not already exist) then the name will be truncated if necessary to an 8.3 style name. We hope to support creation of new long-filename files in a future release. <End quoted material> However, I found by experimentation that this works from an Eu ".ex" file: cmd="cmd /c fsutil file createnew "&dQuote&"C:\\AAA-Real long file name.txt"&dQuote&" 0"--the 0 is filelength puts(1,cmd) puts(1,"\n") system(cmd,2) The long filename file is created. Also, the following code works to create a long-name directory: --having declared cmd, path, longDirName, and dQuote and defined appropriately cmd="cmd /c md "&dQuote&path&longDirName&dQuote puts(1,cmd) puts(1,"\n") system(cmd,2) Works fine. The surprising thing to me is the emulated old-DOS can call the cmd.exe program that called it. More knowledgeable people can explain this better, I have no doubt. So, it looks as if there may be no problem dealing with long filenames in ".ex" files, but of course there may be some "gottcha's" waiting... Also the ability to call the command set of cmd.exe is suggestive. --Quark