You're not using MS-DOS; it did not even allow file extensions longer than 3 characters. You're using the Windows command line – the cmd.exe
shell, specifically.
But Windows indeed tries hard to remain compatible with programs from that era. So, up until Windows 8 (or something like that), all files with longer extensions have an alias that has the extension truncated, along with the name itself.
If you run dir /x
, you'll likely see that each file has a "short name" assigned to it, which is limited to 8+3 characters, just like in MS-DOS and 16-bit Windows.
These names are there in case the user wanted to, let's say, upgrade to Windows 95 and still access their files through programs originally written for Windows 3.1 – so running a 16-bit program wouldn't crash, but would merely show C:\PROGRA~1
and C:\MYDOCU~1\CALENDAR.TXT
in place of C:\Program Files
and C:\My Documents\Calendar.txt
.
(And yes, some people did actually use old 16-bit software even in Windows XP/Vista days... I'm pretty sure Windows 8 turn off the "short names" by default, however. This might be why @EBGreen isn't seeing the same 'problem'...)
Another thing to consider is that the old Windows shell, cmd.exe
, has grown quite a few quirks and compatibility fixes in itself. For example, due to the way MS-DOS matched filenames, dir .txt
meant the same as dir *.txt
, even though it wasn't intentional. But people got used to the shorter syntax, and even though the Windows operating system itself doesn't treat .txt
as a wildcard anymore, cmd.exe
still accepts that syntax. (The dir
command isn't a program on its own, but built into the shell.)
(Similarly, in the linked article, another wildcard quirk is described – Windows filenames can have no extension at all, but people are really used to typing *.*
, therefore it means the same thing as *
and the lone dot is ignored.)
i noticed that
for
andfind
commands too act as odd asdir
at it – None – 2014-10-13T14:41:26.5271
Possible duplicate of WinXP dir command: 3 and 4 char extensions are the same?
– phuclv – 2017-06-12T02:35:00.577Possible duplicate of Move a file to archive folder in cmd using wildcards and How does the Windows RENAME command interpret wildcards?
– jww – 2018-10-07T21:03:33.923