When we set custom icons for folders, a desktop.ini
file will be generated in it with the following structure:
[.ShellClassInfo]
IconResource=${path to the icon file},0
[ViewState]
Mode=
Vid=
FolderType=Generic
But if you manually create such a file in the directory, the custom icon won't be displayed. It confused me for quite a while until I accidentally looked into file attributes. Surprisingly, I found that the folders I set icons through the property window have a ReadOnly attribute. Then I tried manually adding the ReadOnly attribute for the folders that I tried setting icons by creating desktop.ini
directly, and the custom icons were displayed.
Now I'm wondering, what does the ReadOnly attribute on a folder stand for? Could this behavior be found in any Microsoft documents?
Note that I'm talking about the ReadOnly file attribute on a directory file system entry, which differs from the read-only checkbox displayed in the property window.