Can I set an icon for for an application registered under OpenWith?

1

0

Are there other custom registry settings for the Open With items?

What I'm wondering is if I can use the registry to give a custom icon instead of using the interpreters icon?


Responding to the request to dump a registry key, here it is (anonymized):

C:\>reg query "HKCR\Applications\scriptapp.exe" /s

HKEY_CLASSES_ROOT\Applications\scriptapp.exe
    (Default)    REG_SZ    ScriptApp

HKEY_CLASSES_ROOT\Applications\scriptapp.exe\DefaultIcon
    (Default)    REG_EXPAND_SZ    C:\Util\icos.dll,1

HKEY_CLASSES_ROOT\Applications\scriptapp.exe\shell

HKEY_CLASSES_ROOT\Applications\scriptapp.exe\shell\open
    DefaultIcon    REG_SZ    C:\Util\icos.dll,1
    FriendlyAppName    REG_SZ    ScriptApp

HKEY_CLASSES_ROOT\Applications\scriptapp.exe\shell\open\command
    (Default)    REG_SZ    "C:\Util\strawberry\perl\bin\wperl.exe" "c:\Util\Scripts\launch_master.pl"

Axeman

Posted 2014-07-29T15:29:00.733

Reputation: 149

Do you mean a registry hack like in this article? If not, what do you see in regedit under the HKEY_CLASSES_ROOT entry for your Open With item?

– harrymc – 2014-08-06T12:46:10.303

@harrymc, that has to do with giving the file type an icon. I want to know if I can set the icon in an OpenWith list or dialog. Because the interpreter of the script is the executable, I just get the interpreter's icon. – Axeman – 2014-08-06T13:11:50.743

1

Do you want to change the icon for the interpreter? You can add an icon to its exe using Resource Hacker. See also this article. Placing the icon as first will make it the default.

– harrymc – 2014-08-06T14:25:47.440

Did you try setting a DefaultIcon as explained in the following article? Application Registration

– and31415 – 2014-08-06T15:28:32.227

@and31415, cool article, but doesn't seem to have worked. – Axeman – 2014-08-07T00:42:32.697

It looks like the documentation isn't entirely correct/up-to-date. For example, as of Windows XP, the FriendlyAppName registry value needs to be placed under the shell\open subkey in order to work. I tried using Process Monitor to check whether the DefaultIcon key was being read, but it doesn't seem the case. Could you post the output of the reg query "HKCR\Applications\interpreter.exe" /s command, just in case?

– and31415 – 2014-08-07T09:24:44.257

Try resetting your icon cache (end task explorer.exe, delete IconCache.db, run explorer.exe) – Jason – 2014-08-07T17:37:36.453

Please answer my second comment. – harrymc – 2014-08-07T19:22:14.233

@harrymc, I do not want to change the icon of the script interpreter, that seems overkill. – Axeman – 2014-08-07T20:32:57.560

Answers

2

I believe that the only way to change the icon that is displayed on the OpenWith executable, is to change that icon inside that executable (or add one).

You can add an icon to its exe using Resource Hacker.
For details, see the article : Windows 7: Icons - Change Using Resource Hacker.

Placing the new icon as first will make it the default.


Another idea would be to assign different file-types to your scripts, for example .my1 for script1.my1 and .my2 for script2.my2, and give each file-type a different icon, as described in this article.

Define all file-types as executing "\path\interpreter.exe %1" where %1 stands for the script parameter.

That will give you a different icon per each script file-type, and you will not need at all the OpenWith dialog box - just double-click the script-file. The script-files will automatically be displayed in Explorer with their icons.

If the Windows file-types tool is unwieldy, you could use FileTypesMan.
You can also load such file-types directly into the registry with a .reg file.

harrymc

Posted 2014-07-29T15:29:00.733

Reputation: 306 093

I was hoping for a niftier way that I just couldn't find documentation for. The interpreter icon doesn't bother me so much that I can't live with it. As long as it has the title that I wanted, which it does. – Axeman – 2014-08-08T19:46:29.230

I added another idea above. – harrymc – 2014-08-08T20:26:52.393

1

No, you can't change the icon in "Open With".

The key HKEY_CLASSES_ROOT\Applications\scriptapp.exe\DefaultIcon is for changing the icon of the files associated with scriptapp.exe.

Creating a value of DefaultIcon in HKEY_CLASSES_ROOT\Applications\scriptapp.exe\shell\open is not supported.

As others have suggested, if this is necessary, you should change the icon for scriptapp.exe.

Jason

Posted 2014-07-29T15:29:00.733

Reputation: 5 925

There is no scriptapp.exe. It is simply the entry under Applications so that I can use a Perl script as an OpenWith entry. That would require me to change the icon for Perl, and the whole idea was to deploy more scripts as "OpenWith Apps". – Axeman – 2014-08-07T22:35:34.303

@Axeman What I said still applies. Since it's not possible, perhaps you could explain more of your situation. I'm sure the community could help you find a better way. – Jason – 2014-08-08T01:09:53.870

I was hoping for a niftier way that I just couldn't find documentation for. The interpreter icon doesn't bother me so much that I can't live with it. As long as it has the title that I wanted, which it does. – Axeman – 2014-08-08T19:46:57.873

0

There is no scriptapp.exe. It is simply the entry under Applications so that I can use a Perl script as an OpenWith entry. That would require me to change the icon for Perl, and the whole idea was to deploy more scripts as "OpenWith Apps".

No idea what this mean and why this need.

Probably you need compile .pl script to .exe with PP and with option set icon. More info

crazypotato

Posted 2014-07-29T15:29:00.733

Reputation: 678

I can also write a little AHK (Autohotkey) script to encapsulate the command line and compile it with their compiler. But the object was to see how far I could go in creating an "Application" with just an interpreter, a script, and some config. Each script would be a different "application". – Axeman – 2014-08-08T19:54:13.657