How to set relative path for icons in Windows

icons, windows

Solution

Place a file called `desktop.ini` inside each folder and fill it with this content:

[.ShellClassInfo]
IconResource=..\Icons\my_resourceDLL.dll,XXX

Or:

IconResource=..\Icons\icon.ico,0

Where `XXX` is the icon number. `..\Icons` is a relative path, you can use your own dir name.

Problem

We are trying to disribute Pen Drives for a certain cause and we have some folders for which we want to display our own custom icons. The .ico files are present on the pen-drive itself. We are trying the old-school method for changing the icons i.e. Properties > Customize > Change Icon However, the problem is that on different systems, the drive-letter changes and so does the path. Due to this, the icons don't get displayed as we intend them to do. Please suggest a way to set the path of the icons in such a way that they can be displayed on all systems regardless of the drive-letter of the usb-drive.

Original source