4

I have a folder with a custom icon and its setting is stored in desktop.ini I believe. I wanted to apply that same icon to a bunch of folders. So I thought simply copying desktop.ini to any other folder would do the job, but Windows Explorer doesn't update the folder icon by reading from the newly copied desktop.ini file.

How to get Windows to read copied desktop.ini file?

3 Answers3

6

Apply the read-only attribute for each folder. From a Command Prompt window, type:

attrib +r path\folder

This will make Explorer process the desktop.ini file for that folder.

w32sh
  • 12,379
1

In my case I needed to set the read-only attribute to several dozens of folders, so I came up with a couple of command lines to help doing this faster.

Here I wanted to do this to every folders in D:, just replace it with the specific path to the group of folders you'd want to affect :

attrib +r D:* /s /d

First this would give the readonly attribute to every single thing

attrib -r D:* /s

Then this would remove back readonly from every single file (excluding folders).

Estecka
  • 203
1

Makes sense. Microsoft tells us to use attrib +s folderPath (reference), which works great for me (technically, using +s or +r both work, because the +s is transposed to +r on file folders).

But then again, they say to use the PathMakeSystemFolder PInvoke to do the same thing, but I tried it until the cow came to the barn to empty their swollen utters, but it "failed", though the Boolean result indicates success (be sure the filepath string for PathMakeSystemFolderW is marshaled to LPWSTR).

It even set the folder's Read-Only flag, which a folder needs to even consider the dekstop.ini file, which must in turn have attributes Hidden and System set. I later found out that attrib +s will set these two attributes on desktop.ini, if found in the target folder, but PathMakeSystemFolder does not.

As a 40+ year Assembler and C++ Software Designer and Engineer, I should have already known that this PInvoke would only do the one task! Thus, just as the MS article pointed out (if we would only read it the way they want us to, not the way we want to), we also have to ensure the desktop.ini file attributes are also set to System and Hidden. Just when I think "I are smart!"

Destroy666
  • 12,350