Windows long file names and file associations

  • For compatibility, every Windoze file gets an old-school “8+3” name. In W98/Me, if you type dir after you Run » command you’ll see the long and 8+3 names together. (In Win2K/XP, use dir /x and launch Command Prompt from the Start menu, under [ All Programs » ] Accessories.)
  • Folder names generally have a null extension, but it’s not a requirement — cd "Acrobat 6.0" is equivalent to cd ACROBA~1.0 (but simply cd ACROBA~1 is different and will not work).
  • The 3-character part of the short filename is the extension, sometimes incorrectly referred to as the file type. A file of type “image/jpeg” might be named using an extension of .JPG, .JPEG, .JPE, .JFIF, or no extension at all. (Usually only files imported from non-Windoze systems truly have no extension. Also note that in the 8+3 name, .jpeg and .jfif reduce respectively to .JPE and .JFI.) A file named with an extension of .INF might contain, say, Inform source code … or Windoze install parameters — two completely different file types. Here’s a handy list of commonly encountered file types.
  • Your Folder Options (accessed through Tools or View on various Windoze Explorer versions) may cause an 8+3 name to display in mixed or all lower case, and applications [e.g. web browsers] have case-insensitive access to local files with 8+3 names, but 8+3 names always revert to pure upper case when seen across a network or copied to a floppy disk or some flash and ZIP drives. (This can bite you when you upload a file to a case-sensitive web server!) Also, re-saving a file from a legacy utility like Debug can remove its long name, leaving only the 8+3 name. (You can’t remove the 8+3 name without losing the file, since it sits at the very beginning of the file’s directory entry.)
  • Folder options can suppress display of the extension. This is a dangerous feature that you should turn off by UNchecking the option Hide extensions for known file types — unless you want to risk turning loose malware like MyWorm.jpg.vbs on your PC.
  • Windoze when opening a file will guess a file’s type (and opener application) from its extension by blindly obeying the file associations list. (Compare to MacOS, where each file’s directory entry can designate a preferred opener application, regardless of the file’s name.) When entering opener application paths in the file associations [aka Open With] table, call out all folder names in 8+3 style (e.g. ACROBA~1.0 above) — unless you want to waste time repairing file associations that don’t even look broken. Read more about the care and feeding of file associations at this M$ help page.
  • A file has both long and short versions of its name only if it needs to — i.e. if the true name contains spaces, special characters beyond -_!~$%^&'()` , more than eight characters before [or three after] a dot, or more than one dot:
    • index.html is INDEX~1.HTM
    • Black Dog.mp3 is BLACKD~1.MP3 (not BLACK_~1.MP3)
    • dot[0].gif is DOT_0_~1.GIF
    • nn.4.79 is NN4~1.79
    • MyWorm.vbs is MYWORM.VBS (but probably MYWORM~1.VBS on Windoze local disks, because of mixed case)
  • Yes, long filenames work in VB, as long as they’re "in double quotes" (or even better, dropped into a String variable). What trips people up is that VB may be looking for the file in a different place than you’d expect. If you launch, say, Excel from a shortcut, the folder named in the shortcut’s Starts in: property becomes the initial home directory where VB looks for files referenced in your scripts. [Actually, I now find, there’s an overriding setting in Excel at Tools • Options • General, under Default file location.]  In either case, this setting can shift while Excel is running — if a user navigates away from the default directory to open a file manually, the VB current directory follows! So to be sure of where you are, precede each VB Open command with a ChDir to a full path from drive root, like this (the first \ is very important)
    ChDir "\Documents and Settings\fulano\My Documents\Payroll"

visit Bukilandia