Windows Explorer – why at-character @ sometimes is not allowed in filenames

filenameswindowswindows-explorer

I knew many restricted and special characters in file and folder names that impossible to use, or they can cause trouble later.

For example putting a dot at the end of the name will cause it to disappear.

Explorer itself has more restrictions, for example a dot at the beginning of filename is very hard to put.

OK, but what's wrong with at-sign @ !?
I didn't saw anywhere any restrictions about it, nor could I find it now.

See:

1) Open Windows Explorer and create a file or folder with name 1,1
2) Press F2 and rename it to @1,1
3) See? New name was cancelled.

My question is: WHY?

I tested this "feature" on XP, Win7 and Win10.
Funny thing in WinXP is that renaming 0,0 to @0,0 actually renames it to @0.

Looks like this is internal Explorer behavior, because in CMD console it is perfectly fine to do cd.>"@1,1"

Best Answer

I don't know why Explorer forbids such renames, but it's likely to do with a localization feature.

Various parts of Explorer use the @<DllName>,<ResourceID> syntax for dynamically loading localized text – see registry string redirection. (Note that the resource ID is always a decimal number, often negative.)

  • For example, the description for .lnk shortcuts in Registry is @shell32.dll,-4153, which means "load string with ID -4153 from file shell32.dll". Since DLL files can have a separate resource table for every supported language, the resulting description will be translated to whatever display language Windows is set to.

  • Similarly, your Desktop; Documents; Pictures; ... directories have a hidden desktop.ini file containing:

    [.ShellClassInfo]
    LocalizedResourceName=@%SystemRoot%\system32\shell32.dll,-21769
    IconResource=%SystemRoot%\system32\imageres.dll,-183
    

    When Explorer sees this file, it won't just show the folder as "Desktop" – it will show the translated name.

Simply using the redirection syntax in an actual file/directory name won't do anything, but my guess is that it was forbidden to prevent various bugs in case a program mixes up the "real" and "display" names in some manner. (For example, if you name a directory @shell32.dll,-21769, it is possible that a buggy program will keep trying to access Desktop instead. This might even create security issues.)

So that would be similar to various other names which Windows allows but Explorer does not (e.g. .foo which is a regular "hidden file" for Unixen, but can be mistaken for a nameless (extension-only) file by some Windows programs).

Related Question