How does "PROGRA~1" path notation work? [duplicate]

Since my first Windows 98 (and even now on Win7), I could enter the first 6 letters (symbols) of a folder's name and add ~1 after it (when there was just one folder with those six letters in current directory), and it would work as the full name of it. And it appears that if there are more than one folder with the same six first symbols in its name, I can use FOLDER~2 and so on, and it will open the corresponding folder, as if I entered its full name. Like c:\progra~1 will open C:\Program Files and c:\progra~2 will open C:\Program Files (x86) on win7 64 bit.

How does this work?


Knowledge base entry

Basically on FAT systems all directory entries are still stored in a format compatible with the old 8.3 format; longer names are stored in a series of hidden entries. The short name is there for compatibility.


These are 8.3 filenames, and date back to the days of MS-DOS, which did not support longer filenames.

Windows 95 and VFAT introduced the ~N tilde notation as a backward compatibility mechanism, to give each long file name a unique 8.3 short file name, too.