Changing the icon of a drive

Changing the icon of a drive

By editing the Registry it is possible to change the icon that Windows Explorer uses for a drive. For example, if you want to change Drive E’s icon, create the following registry key:

HEKEY_LOCAL_MACHINESoftwareMicrosoftWindowsCurrent VersionExplorerDriveIconsEDefaultIcon

When you create the above key, a string value named “Default” with value not set is automatically created. What you have to do is setting this value with the path of the icon, and this changes the drive icon of Drive E.

If you want revert back the default Icon, just delete the value of the “Default” string value, or just delete the above registry key.Here are two reusable routines to set or reset the icon for a specified drive:

Sub ChangeDriveIcon(ByVal driveLetter As String, ByVal icoPath As String)    Dim regKey As String    regKey = "SoftwareMicrosoftWindowsCurrentVersionExplorerDriveIcons" & _        driveLetter & "DefaultIcon"        ' create the parent key    CreateRegistryKey HKEY_LOCAL_MACHINE, regKey    ' set the (Default) value with the icon's path    SetRegistryValue HKEY_LOCAL_MACHINE, regKey, "", icoPathEnd SubSub ResetDriveIcon(ByVal driveLetter As String)    Dim regKey As String    regKey = "SoftwareMicrosoftWindowsCurrentVersionExplorerDriveIcons" & _        driveLetter & "DefaultIcon"            ' delete the key    DeleteRegistryKey HKEY_LOCAL_MACHINE, regKeyEnd Sub


Share the Post: