Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to set DefaultIcon in registry

I am attempting to update the Windows registry to add an icon for my custom file extension, and I have thus far been unsuccessful. My current version is closest to this stackoverflow question. Unfortunately, my file's icon is still one of the generic built-in Windows icons (see screenshot below).

enter image description here

At this point my best guess is perhaps there is something wrong with my .ICO file. I have shared it here on Dropbox

Here is the full registry update I'm making with regedit. As you can see, I am also associating my file extension with a .bat file for execution. That works great. Also the Type displayed in Windows Explorer is PartQuest Archive which is also great (see above screenshot). Alas, no dice with the last entry for the icon.

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\pqunzip]
@="PartQuest Archive"

[HKEY_CLASSES_ROOT\pqunzip\shell]

[HKEY_CLASSES_ROOT\pqunzip\shell\open]

[HKEY_CLASSES_ROOT\pqunzip\shell\open\command]
@="\"C:\\MentorGraphics\\PartQuestTools\\SDD_HOME\\common\\win32\\scripts\\pqunzip.bat\" \"%1\""

[HKEY_CLASSES_ROOT\.pqz]
@="pqunzip"

[HKEY_CLASSES_ROOT\.pqz\DefaultIcon]
@="\"C:\\MentorGraphics\\PartQuestTools\\SDD_HOME\\common\\win32\\config\\decrypted.ico\""

I have also attempted adding a ,1 to the end of the file name since the .ICO file appears it may have two icons embedded in it. This is did not make a difference.

For good measure, I have been rebooting after each change. I'm not certain if this is necessary.

Any tips from the Windows experts around here will certainly be appreciated!

like image 645
joescii Avatar asked Nov 09 '22 08:11

joescii


1 Answers

So I did a little reverse-engineering to figure out the issue based on 7Zip's file associations. It turns out that the DefaultIcon key entry should be a child of the application, not the file name. So in my case I need it associated with pqunzip rather than .pqz:

[HKEY_CLASSES_ROOT\pqunzip\DefaultIcon]
@="\"C:\\MentorGraphics\\PartQuestTools\\SDD_HOME\\common\\win32\\config\\decrypted.ico\""

For maximal clarity, this is the entire contents of my .req file that works as expected:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\pqunzip]
@="PartQuest Archive"

[HKEY_CLASSES_ROOT\pqunzip\shell]

[HKEY_CLASSES_ROOT\pqunzip\shell\open]

[HKEY_CLASSES_ROOT\pqunzip\shell\open\command]
@="\"C:\\MentorGraphics\\PartQuestTools\\SDD_HOME\\common\\win32\\scripts\\pqunzip.bat\" \"%1\""

[HKEY_CLASSES_ROOT\pqunzip\DefaultIcon]
@="\"C:\\MentorGraphics\\PartQuestTools\\SDD_HOME\\common\\win32\\config\\decrypted.ico\""

[HKEY_CLASSES_ROOT\.pqz]
@="pqunzip"
like image 68
joescii Avatar answered Nov 15 '22 10:11

joescii