Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've got a simple desktop.ini file that applies a folder icon. I'd like it to work on a network location, as we have an external hard drive connected to our network. However, the desktop.ini seems to have no effect on said network.

What am I doing wrong?

share|improve this question

You have to mark the folder as system or readonly, to make the desktop.ini work. readonly is better, as system folders are omitted from explorer-searches by default. attrib +r (folder name)

share|improve this answer

Have a read at this article


If you want to specify a custom icon for the folder, set this entry to the icon’s file name. The .ico file extension is preferred, but it is also possible to specify .bmp files, or .exe and .dll files that contain icons. If you use a relative path, the icon is available to people who view the folder over the network. You must also set the Icon Index entry.

In over words you will have to specify a relative path to your icon

eg ./hiddenfolder/mycoolicon.ico

Note that you may need to place two (or more) dots if the directory of the .ico folder lies outside of the location of the desktop.ini file- try experimenting and refreshing the Windows/File Explorer window.

Good Luck

share|improve this answer
No, that's not the problem. The desktop.ini file seems to be ignored, as none of the other commands in it are being processed either. Interestingly, I can't set it to be "hidden". – Eric Jun 7 '10 at 10:28
What OS are you using to view the shared folder? – Christopher Wilson Jun 7 '10 at 12:47
Windows XP. [15 char limit] – Eric Jun 8 '10 at 6:52

The problem has to do with the host containing the folder. Some network attached storage device (NAS), like the DROBO for example, run internally on Linux and their SAMBA network shell does not respect nor correctly implement the standard windows file attributes (R,S,H,A,I).

So relative paths will NOT help if the desktop.ini file is not read in the first place !!!

Because the host device, RAID, NAS or drive does not correctly report the "System" or "Read only" bit which windows expects to trigger the processing of the desktop.ini file, the file is never read and its contents do not matter.

Have found no solution to this problem yet.

share|improve this answer

Why this happens

Windows will not read the desktop.ini unless it's a system file (seemingly readonly also works, but system file means it can stay hidden even when you set non-system hidden files to visible).

Why you seemingly can't fix it

On a Samba share (Unix implementation of SMB/network share protocol), sometimes even if you e.g., go to properties and set "read only", it will be ignored and not set. This is because Samba isn't by default storing these permissions - which seems to carry a (probably negligible) performance tax, as permissions are (AFAIK) set and read in alternate streams as textual data (probably wouldn't work if you're sharing some rudimentary FS such as FAT).

How to fix it

First make sure Samba stores DOS-style permissions (like "system"), by adding this line on your share definition:

store dos attributes = yes

Maybe you can add this to [Global], I've added it to a specific share instead.

Also, some people will tell you to edit the wrong file.

  • /usr/share/samba/smb.conf <= nonsense
  • /etc/samba/smb.conf <= right file

Restart Samba (sudo service samba restart), then make a quick check to see if you can use Windows Explorer to make a file read only for example, and if it persists.

Ok, now, you can make the desktop.ini a system/hidden file. To do this, go to the folder where it is with command prompt, and use:

attrib +s +h desktop.ini

Optionally also (if your icon is relative and stored in the same folder as mine is).

attrib +s +h folder.ico

Lastly, you need to mark the folder itself as read-only (makes no sense and sounds stupid, so you know it's legit).

attrib +r .

Of cours, you can (should) script this. Using MSysGit's bash, I did this on my whole NAS:

find . -type f -iname desktop.ini | while read -r i; do
    echo "Processing \"$(basename "${i%/*}")\""
    attrib +s +h "$i"
    attrib +s +h "${i%/*}/folder.ico" # Optional, in case you have these.
    attrib +r "${i%/*}"
share|improve this answer

To report correctly the file type "System" or "Read only", you have to modify the "smb.conf" in your NAS. In the [Global] section, add the line :

store dos attributes = yes

Enjoy !


share|improve this answer
Don't forget to restart Samba service with the cmd : sudo service samba restart – M2C Apr 22 at 17:36
I wasn't the one who downvoted you, but in my case I had to set this in a share definition. I had set in global and it was ignored. – Camilo Martin Jun 4 at 9:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .