Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set relative path for icons in Windows

Tags:

windows

icons

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.

like image 588
iamtushara Avatar asked Jan 14 '14 12:01

iamtushara


People also ask

How do I create a relative path shortcut?

Make a new shortcut to: cmd.exe /c start. Now right-click on it and get properties of the shortcut (shortcut tab). The full shortcut path should have been set to this: %windir%\system32\cmd.exe /c start .

How do I create a relative path to a folder?

Relative paths make use of two special symbols, a dot (.) and a double-dot (..), which translate into the current directory and the parent directory. Double dots are used for moving up in the hierarchy. A single dot represents the current directory itself.

How do I find the relative file path in Windows?

Click the Start button and then click Computer, click to open the location of the desired file, hold down the Shift key and right-click the file. Copy As Path: Click this option to paste the full file path into a document. Properties: Click this option to immediately view the full file path (location).


1 Answers

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.

like image 68
egur Avatar answered Sep 30 '22 23:09

egur