0

In Linux, hidden files are given an "extension" but no filename, such as .bashrc. From the Windows command line, the following all work:

  • echo Hello world! > .aaa
  • copy .aaa .bbb
  • ren .bbb .ccc

From Windows Explorer, existing zero-length files can be copied. For example, if the copy of .aaa is named automatically as - Copy.aaa. Attempting to rename .aaa to .bbb, however, results in the error You must type a filename.

Why are zero-length filenames invalid in Windows Explorer when they are valid objects in the file system itself? Is this a bug in Windows Explorer? If relevant, using Windows 8.1.

For now, I'll create zero-length filenames from the Windows command line.

6
  • Windows Explorer allows you to hide extensions; if a file is only an extension, it will thus be invisible when extensions are hidden. Jan 24 '20 at 13:03
  • Extensions are not hidden. As a side note, its curious that Microsoft hasn't deleted this dumb setting long ago. Why hide extensions?
    – AlainD
    Jan 24 '20 at 13:12
  • It doesn't matter whether the extensions are hidden or not; the issue is because they can be hidden. The ability to hide extensions is because of the "need" to make everything user-friendly; if the extensions are hidden, then Grandma can't accidentally make it impossible to open emailed photos with IrfanView because she didn't preserve the '.jpg' when she renamed it from 'PIC1234' to 'Bobby at the Zoo'. Jan 24 '20 at 15:30
  • Interesting perspective. Doesn't that just reinforce the idea that hiding extensions is a poor design choice?
    – AlainD
    Jan 24 '20 at 16:26
  • That depends. If you take the position that one should not use a computer without understanding what's going on inside, then yes, it's a poor design choice. That's likely why most power users turn that setting off, and expose the extensions, complete with risk factors. But if you take the position that a computer can and should be an appliance, then hiding the extensions is a way of protecting the (non-knowledgeable) user from doing things that May Cause Problems. Jan 24 '20 at 16:36
1

I don't think there's an official Microsoft statement whether this is a bug or intended behavior.

There's, however, a trick to use such name without getting the "You must type a filename" error: name the file .bbb. (extra dot at the end), Windows Explorer will happily autocorrect it to .bbb!

1
  • 1
    Oh wow, that works! First you get the warning If you change a filename extension, the file might become unusable. Are you sure you want to change it?. Thereafter Explorer auto-corrects to the desired name. Both weird and awesome! Nice trick, thanks.
    – AlainD
    Jan 24 '20 at 13:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.