How can I add an icon to my custom context menu item in Windows 7?

Related: How can I add a program to the context menu of all files?

I've created my custom context menu item, and it seems to work on all file types - even through shortcut links. (Selecting my custom option performs the operation on the shortcut target, not the .lnk file.) Now, I'd like to create an icon to make it stand out. My antivirus program and Notepad++ seem to have been able to do this, so I know it's possible. The only question is, how?


Solution 1:

Open regedit.exe and find the key that you created for the custom menu item.

Now create a new String value in it and name it Icon. Double-click it and enter the path to your custom icon file:

c:\folder\icon.ico

Optionally you could use the Windows shell32.dll file like in my example: Registry

The result:

Icon in custom context menu

Just an additional note - looks like this method works on Windows 7 (and probably Vista) but the icon did not appear when I tested on Windows XP.

Solution 2:

...And If you want, you can use the default/same icon that your program (exe file) already is using.

Simply use something like below as the content of your Icon string value that @Slim K pointed you to in his answer:

"C:\Path\to\YourProgram.exe",0

Sublime Text 3 doesn't use an icon for its context menu option. So I added an Icon string value with the content you see in screenshot.

1

2