# Add icon in Windows Context Menu

#1

Hello,

I think it would be nice and easier to see if you added the application icon to the left of the context menu label, like Notepad++ does for example.
Attached screenshot.

0 Likes

#2

You can do this easily by adding an Icon entry to the registry.

reg add "HKLM\Software\Classes\Applications\sublime_text.exe\shell" /t REG_EXPAND_SZ /v "Icon" /d "c:\path\to\sublime_text.exe,0"

I use the portable version so I’m not sure that is the exact location the installed version of sublime text is registered at.
Remember, registry editing is risky blah blah blah

0 Likes

#3

Clever, thanks atomi.

0 Likes

#4

The Icon doesn’t show.

The key is here:
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Applications\sublime_text.exe\shell

And the path to sublime_text.exe is correct.

Any idea why that didn’t work?

0 Likes

#5

[quote=“Francisc”]The Icon doesn’t show.

The key is here:
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Applications\sublime_text.exe\shell

And the path to sublime_text.exe is correct.

Any idea why that didn’t work?[/quote]

I really don’t have any idea how the installed version of Sublime sets up it’s file associations.
Instead of Icon it might be DefaultIcon… you might have to google this sorry.
I don’t add icons for sublime verb, I set sublime to replace notepad.exe - wish I could help more.

Edit: this might get you going in the right direction
winhelponline.com/blog/chang … and-vista/
What I would do is search for the string “Open with Sublime Text 2” in the registry and add a DefaultIcon entry under that registry key (should be in HKLM).

0 Likes

#6

Hi Atomi, this is what I did last night:

reg add “HKEY_CLASSES_ROOT*\shell\Open with Sublime Text 2” /t REG_EXPAND_SZ /v “Icon” /d “path-to-install-dir\sublime_text.exe,0”

I compared what other files that had icons did and took it from there.

Thanks.

0 Likes

#7

[quote=“Francisc”]Hi Atomi, this is what I did last night:

reg add “HKEY_CLASSES_ROOT*\shell\Open with Sublime Text 2” /t REG_EXPAND_SZ /v “Icon” /d “path-to-install-dir\sublime_text.exe,0”

I compared what other files that had icons did and took it from there.

Thanks.[/quote]

Nice. Thanks for posting back here.
It’s better to put it in HKLM as HKCR is just a copy of HKLM.
The key should be “HKLM/Software/Classes/*/shell/Open with Sublime Text 2”
But glad you got it working.

0 Likes

#8

OK, I’ll make the changes.
The reason I added it there was that “Open with Sublime Text 2” was there in the first place and no where to be seen in the Local_Machine.

0 Likes