Why can’t you rename the Recycle Bin?


Commenter zd asks, "Why can't you rename the Recycle Bin?"

This question, as do many questions, comes with implicit assumptions. In particular, the assumption that everything can be renamed by default and that somebody must have gone to the effort of blocking the rename of the Recycle Bin.

Actually, reality is the reverse. Shell namespace objects cannot be renamed by default. Code has to be written to support rename. This is a special case of something Ry Jones saved, namely, that features start out nonexistent and somebody has to make them happen.

To support renaming, the shell folder needs to support IShellFolder::SetNameOf and then needs to find a place to save that new name so that the next time somebody calls IShellFolder::GetDisplayNameOf, the name you set is returned instead of the original name. Other technical points are making sure that shortcuts that were created to the object before the rename still work after the rename, and that you didn't break any code that tried to access the object by its old name. That last bit is scary, because third-party programs have a habit of hard-coding all sorts of stuff. (I can imagine there's some program that looks for an object called "Recycle Bin" and crashes if it can't find it.)

Besides, you can't rename Control Panel icons either.

Comments (31)
  1. Brian says:

    The fact it’s renamed in localized versions of windows implies it is renameable — just not through the standard "F2" interface.

  2. MadQ says:

    Besides, if you really want a "Teh Trash" icon on your desktop instead, you can always create a shortcut, which can be renamed. Nitpicks: And configure the desktop not to show the Recycle Bin. And use TweakUI to remove the shortcut icon overlay, if that bugs you.

    Ditto for Control Panel icons.

  3. Lars says:

    It can be renamed by editing the registry. A quick google search reveals plenty of pages with information on how to do it.

  4. JM says:

    @Brian: Not exactly. Adjusting a localization string which will stay the same for the entire lifetime of the system is not the same thing as allowing users to assign a new name on the fly.

    If I were Raymond, I’d probably have formulated that much snappier and ended it with "I can’t believe I had to write that", but I’m not.

  5. Tim says:

    @SvenGroot:

    "While I use an English version, many people I know use localised versions and to the best of my knowledge such a program hasn’t been encountered yet, fortunately."

    It’s not beyond the bounds of possibility:

    http://technet.microsoft.com/en-us/magazine/cc160898.aspx

  6. John Topley says:

    I remember that when Windows 95 came out, one of the first Registry tweaks I ever came across was the one that let you change the display name of the Recycle Bin. And then later on there was another one that added the Rename context menu item (as if you’d want to rename it that frequently to justify the menu item!)

  7. DCMonkey says:

    As Sven mentioned, you can rename the Recycle Bin in Vista by the standard methods (right click -> Rename, single click on text label, F2)

  8. Xepol says:

    In other words, it is a fundamental design flaw that made it harder to implement the feature than to not.

  9. CGomez says:

    "In other words, it is a fundamental design flaw that made it harder to implement the feature than to not."

    Hahahahaha.  That would imply that all software starts out with the ability to do anything, and only a fundamental design flaw keeps you from implementing features.

    No.  Software starts out as nothing.  Everything else must be implemented.  Things do not for many reasons… like simply not getting around to doing it.

  10. /df says:

    So, if the EditFlags are set to enable the Rename context menu item for the Tr^H^HRecycle Bin, is there in fact anything in Windows that doesn’t work when you rename it?

    (There didn’t seem to be in 98SE).

  11. Paul Betts says:

    I usually name my Recycle Bin "Digital Purgatory"

  12. SvenGroot says:

    If there are any programs that look for an object named "Recycle Bin" they’d fail on localised versions of Windows too. While I use an English version, many people I know use localised versions and to the best of my knowledge such a program hasn’t been encountered yet, fortunately.

    And at least on Vista, you *can* rename the Recycle Bin.

  13. mr kwesjun says:

    Doesn’t renaming the bin also involve changing strings like ‘Are you sure you want to move this file to the recycle bin?’, or does it actually

    format the string already using the correct name obtained through the namespace (perhaps by GUID)?

  14. Dean Harding says:

    kwesjun: That’s easy to test. I just renamed the Recycle Bin on Vista, deleted a file and it still asked me whether I wanted to move the file to the "Recycle Bin".

    So no, changing the name of the Recycle Bin does not also modify those strings.

  15. Miles Archer says:

    This is a unix phenomenon. Everything is a file, so of course you can use file type operations on it. So, if you can’t it must have been removed for a reason.

  16. Paradice says:

    "In other words, it is a fundamental design flaw that made it harder to implement the feature than to not."

    You’re an idiot.

  17. Riyaz Ahemed says:

    I do it by navigating here:

    HKEY_CLASSES_ROOTCLSID{645FF040-5081-101B-9F08-00AA002F954E}ShellFolder

    and by changing the DWORD value of Attributes to FF 01 00 20. Refresh the Registry and the Desktop and lo, you a have all the options of Cut, Copy, Delete and Rename on the Right Click Context Menu of the Recycle Bin.

  18. noone in particular says:

    @Paradise:

    How do you reach this somewhat surprising conclusion?

    Just by observing how Xepol did not limit his thinking to the confines of Windows and MSDN?

    ShellObjects can be renamed. Recycle Bin is a shell object. It either can be renamed or Xepol is right.

    YOUR event horizon may be windows. Other people see other OS and notice the flaws of windows.

    And we are here to have Raymond explain these flaws, and how they can not be undone, because Microsoft fears to break 1000000 wrongly done implementations of "Hello World"

  19. # says:

    > YOUR event horizon may be windows. Other people see other OS and notice the flaws of windows.

    You cannot rename the proc filesystem in unix either.

  20. Michiel says:

    Of course renaming "Recycle Bin" cannot change strings like "Are you sure you want to move this file to the recycle bin?". These sentences must exist independently, as they will be localized independently. You just cannot translate the "to the %ls" part.

  21. Gabe says:

    Miles Archer: The fundamental file operations are open-read-write-close. Renaming a file is actually a directory operation. Things like network sockets and pipes behave like files (you can open/close, read/write them), but renaming them doesn’t make sense.

    Of course there are things like /dev/null which technically you can rename, but things would break horribly if you did.

  22. When reading the codeproject emails, I occasionally see aricles something along the lines of "How to rename the start button programmaticaly".

    http://www.codeproject.com/KB/cs/StartButtonRenamer.aspx

    I’m afraid my tidy little brain can’t comprehend the need to rename the start button so often that it’s worth automating.

    It looks pretty cool though.

  23. SCB says:

    "by changing the DWORD value of Attributes to FF 01 00 20. Refresh the Registry and the Desktop and lo, you a have all the options of Cut, Copy, Delete and Rename on the Right Click Context Menu of the Recycle Bin."

    So if you delete the Recycle Bin, where does it go?

  24. Dean Harding says:

    "ShellObjects can be renamed. Recycle Bin is a shell object. It either can be renamed or Xepol is right."

    Way to prove, yet again, that people don’t read the blog post before posting comments.

  25. mr kwesjun says:

    @Dean Harding: So it shouldn’t be renamed then, especially on shared desktops it’d just be needlessly confusing.

  26. SuperKoko says:

    Raymond wrote:

    "

    I can imagine there’s some program that looks for an object called "Recycle Bin" and crashes if it can’t find it.

    "

    Do you mean, something like that?

    http://blogs.msdn.com/oldnewthing/archive/2007/03/13/1868542.aspx

    At least, this program would never have worked in localized Windows.

  27. Dave says:

    Of course, the question that was really being asked and that Raymond failed to answer was (probably) something like:

    Since you can rename all the other standard desktop icons (My Computer, Network Neighbourhood/My Network Places, My Documents, The Internet, etc), why was the decision made that the Recycle Bin should not be renameable?

    Obviously someone/a group of someones made the effort to make the other icons renamable, so why not the Recycle Bin? Why is it special? Was it simply a time issue (which persisted until Vista due to the fear of breaking things)?

  28. Stephen Jones says:

    Just as a matter of interest how do I get the Recycle bin back to the desktop after I deleted it.

  29. Riyaz Ahemed says:

    @Stephen Jones

    @SCB

    To get back the Recycle Bin on the Desktop flare up the Registry Editor, navigate to

    HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionExplorerDesktopNameSpace

    Right click NameSpace and New >> Key. Name the key to {645FF040-5081-101B-9F08-00AA002F954E}.

    Refresh the Registry Editor and the Desktop.

    I assume that when u delete the Recycle bin itself, just the Namespace Entry from the above key is deleted. U can still delete other files and folders even though the Recycle Bin has been deleted.

  30. @Raymond: I’m sure this would make sense if I understood more about Interfaces, so be kind to this poor dolt…

    Why wouldn’t it be possible/practical to implement this Interface on all shell objects e.g. Implement it on the parent class from which all shell objects derive (if there is such a thing)?

  31. SuperKoko says:

    "Implement it on the parent class from which all shell objects derive (if there is such a thing)?"

    Firstly, COM objects don’t directly support inheritance.

    But, the main issue is that, different shell objects have different behaviors for renaming.

    Renaming a file system object renames the file on disk.

    Renaming a drive letter object changes the disk label.

    Renaming "My Documents" will change a registry base key.

    Some of the code written for "My Documents", "My Computer" and "Network Neighboorhood" could probably be re-used, since their naming behavior is pretty similar.

Comments are closed.