A+: Short filenames for DOS and how they're made from long filenames
Ever since XP, Windows supports LFN, long file and folder names. They cab be as long as 255 characters and can have spaces and most other alphanumeric characters, except for illegal characters which are:
\ / : * ? " < > |
Names of files can have more than one period, but only the characters after the last period are considered the 'extension'; applications commonly have one or more default extension types, such as .DOC for Word, .XLS for Excel, and .HTML or .HTM for web browsers.
So operating systems like DOS which don't have LFN support can access files, Windows also stores a DOS alias (also known as the MS-DOS name) as well as the LFN when a file or folder is created. The DOS alias name is created from the first six letters of the LFN, replacing illegal characters with an underscore, removing spaces, and ignoring additional periods in the LFN. To distinguish between different files with the same DOS alias names, the first DOS alias name in a folder is indicated with a tilde and the number 1 (~1); the second as ~2, and so on. If more than nine files with the same initial letters are saved to a given folder, the first five letters are used for files numbered ~10 and up, and so forth. The three-letter file extension is reused for the DOS alias.