January 5, 2011

Why The Folder Looks That Way

Filed under: Main — admin @ 12:01 am

Sorry about the lack of blog post on the 3rd. Yeah, I missed the first post of the new year, but I’ve just been finishing up yet another major project. Even so, it’s time for a nerdy post to sate all your Windows geeks out there.

Ever wonder why some folders have special pictures on them and others don’t? Well, let me tell you how that works.

Any time you modify a folder in Windows, to either change the folder icon or add a background image to the folder window, you’re editing a secret file called desktop.ini.

I believe that file was first introduced with Windows 95, though the INI filename extension leads me to think it might be older than that.

The desktop.ini file is modified when you customize a folder, so there’s really no need to edit the file directly. That’s because the Customize tab in the folder’s Properties dialog box lets you sufficiently mess with things. That rule doesn’t hold true for the folders pre-created for you by Windows.

Folders such a Documents, Downloads, Music, and others all have pre-assigned icons. Just like folders you modify yourself, those folders have desktop.ini files that determine what those icons are.

To view the desktop.ini files for those folders, you can use the command prompt: Start a command prompt window: From the Start button menu, choose All Programs, Accessories, then Command Prompt.

Say you want to modify the Downloads folder’s icon. First, change to the Downloads folder directory: At the Command Prompt window type cd downloads and press the Enter key.

To view the desktop.ini file’s contents, type in the command type desktop.ini and press the Enter key. You’ll see something like this:

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

There may be more lines in the destkop.ini file in addition to the two shown above. It all depends on how the folder is customized. And, of course, finding out what that cryptic text actually means can be an exercise in futility.

The key item for changing a folder’s icon is IconResource. That item lists the pathname to a file and then the offset of an icon resource stored in that file.

In the example above, the IconResource item shows the file %SystemRoot%\system32\imageres.dll. The text %SystemRoot% refers to the Windows operating system directory, which on 99.9% of the computers out there is C:\Windows.

Within the file imageres.dll are a bunch of icon images. The one at offset -184 is the icon image assigned to the Downloads folder.

If you like, you can edit the desktop.ini file to change the icon. Of course, it helps to know the full list of icons in all the icons files. Even if you don’t, you can edit the file from the command prompt by typing this command:

notepad desktop.ini

Use Notepad to randomly change the icon number, then save the file. When you re-display the Windows Explorer window, it should update the folder’s icon to match whatever icon number you’ve selected.

Yeah, this is all nerdy stuff, but I was in the mood.

No Comments

No comments yet.

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.


Powered by WordPress