2

I'm trying to set an .ico file as my USB flash drive icon.

Icon is located at this path:

C:\Users\Ahsan\Pictures\gear.ico

What i want is: when the USB is connected to my laptop (running windows 10), it may automatically pick up the icon from the above mentioned path.


My autorun.inf code:

[AutoRun]
ICON="%SystemDrive%\%USERPROFILE%\Pictures\gear.ico"
LABEL=MyUSB

Result: Label gets changed by this autorun file, but the icon is not getting changed.


Another attempt

[AutoRun]
ICON="C:\Users\Ahsan\Pictures\gear.ico"
LABEL=MyUSB

Result: Again the label changes to MyUSB, but the icon is not changing.


I just don't know, how to properly mention the path to that icon file which is placed in C: drive.

I shall be VERY THANKFUL if somebody please help me with my problem.

Io-oI
  • 9,237
McFly
  • 97

2 Answers2

2

The icon's file must be in the same directory as the file specified. The solution is to locate the icon file on your USB drive

Ack
  • 633
  • 4
  • 12
1

The fact that your changes work is true; what happens, which you don't notice, is the presence of a cache using other icons for folders and drives on your system. Without clearing and refreshing this cache, your actions that do work won't be visible.

[AutoRun]
ICON="%SystemDrive%\%USERPROFILE%\Pictures\gear.ico" ✅
LABEL=MyUSB

A method I used for a long time on CD/DVD/USB drives was:

1. I took an .ico file and renamed it to Thumbs.db

2. I used Attrib +r +s +h D:\Thumbs.db.

3.. I edited the Autorun.inf or Desktop.ini file

  • (yes, I also used it for folders on drives/media).

4. In Autorun.inf, it would be: ICON=.\Thumbs.db

5. For Desktop.ini, it would be: IconFile=.\Thumbs.db

6 This way, the .ico file stays in the same folder or root directory. After that, I executed Attrib +s +r +h ... on the corresponding Autorun.inf or Desktop.ini file.


I used to do this manually. However, if you use the Windows interface to assign an icon to a folder, it automatically replaces the icon during the action performed via the GUI. When doing it manually without clearing the cache, you’ll only notice the changes if your device is connected to another USB port and/or the system assigns a different drive letter to the unit. In that case, you’ll see the change without clearing the cache. Otherwise, you’ll need to clear the cache to see the changes without restarting.

Remember that there are "system configuration" programs that can be used to clear caches upon reboot, including those related to thumbnails. In this scenario, after restarting, you’ll see the changes made during the action.


It was very tedious to make an entire CD/DVD/USB drive have icons from the root all the way down to the last folder/subfolder, but I used to do it manually, one by one. Later, I created a batch script that, with drag and drop of the folder/drive, would handle everything automatically via script. I would place the icon in the root and each folder/subfolder, then drag and drop, and the script would loop through all of them, one by one.

Why didn’t I do this from the start? Well, I created it about 1 or 2 years before this practice became obsolete. I still laugh at myself to this day when I remember it...


What Are Thumbs.db Files?
Refresh Icon Cache Without Rebooting

Io-oI
  • 9,237