Open the Registry Editor, navigate to HKCR
(although HKCU\Software\Classes
would be a better location, but most are lazy). For every file type, create a zero-length string value named AlwaysShowExt
.
For example, if you have .txt
:
Navigate to the subkey for the extension – HKCR\.txt
– and note the data stored in the "(Default)
" value – it usually says txtfile
.
Navigate to the file type subkey HKCR\txtfile
, right-click the value list, choose New → String value, and name the new value AlwaysShowExt
.
Not all extensions have separate subkeys for file types – sometimes all information is kept directly under HKCR\.myext
. In such cases, AlwaysShowExt
goes directly to the extension subkey as well.
It is very likely that there are dedicated programs for editing file types, possibly with support for AlwaysShowExt
and other flags. I don't know any to recommend, though.
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.)
Best Answer
The
rename
command allows for a wildcard:rename *.txt *.md
would rename all files in one call, in the current directory.Now you just need to traverse all directories down from the root dir. For this, there is a
for
command:cd /d <rootdir> & for /R %d in (.) do @echo %d
Putting it all together: