devxlogo

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

See also  5 Ways to Improve Customer Experience
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist