How to Add Icon to a Context Menu Item in Windows

When working with Windows 7 RC this week, I stumbled upon another nice and useful feature that I thought I should write about. In Windows 7 and higher, you can add icons to your custom right-click (static) menu entries.

Usually, to display a right-click command with an icon, one needs to write a context menu handler Shell Extension (DLL). Now, you can assign icons for static menu items as well, without having to program anything.

The instructions in this article apply to Windows 7 through Windows 10.

For example, when you add a custom right-click command “Print Directory” using the instructions in the article Print directory contents you see this when you right-click on a directory.



So far so good. Now, you can mention an icon reference which either points to an icon resource inside a .DLL, .EXE, or an .ICO file.

Add an Icon to a Right-Click Menu Entry

  1. Launch the Registry Editor (regedit.exe)
  2. Navigate to the corresponding registry key for the menu item. For example, if you used the previously mentioned link to add the Print Directory command to the context menu, navigate to the following key:
    HKEY_CLASSES_ROOT\Directory\Shell\PrintDir
  3. In the right pane, create a String value (REG_SZ) named Icon
  4. Double-click Icon and type the path to an icon (.ico) file. Or mention the icon library file name and the icon index.
  5. Exit the Registry Editor. Now, right-click on a directory and you’ll see a printer icon near the Print Directory command.

The above registry edit works in Windows 7 through Windows 10.

Other Examples

add open with notepad to right-click
“Open with Notepad” context menu entry with Notepad icon.

Reference: Add “Open with Notepad” to the Right-click Menu

Notepad++ right-click menu in Windows
“Open with Notepad++” context menu — with Notepad++ icon.

Reference: Add “Open with Notepad++” to the Right-Click Menu


One small request: If you liked this post, please share this?

One "tiny" share from you would seriously help a lot with the growth of this blog. Some great suggestions:
  • Pin it!
  • Share it to your favorite blog + Facebook, Reddit
  • Tweet it!
So thank you so much for your support, my reader. It won't take more than 10 seconds of your time. The share buttons are right below. :)

Ramesh Srinivasan is passionate about Microsoft technologies and he has been a consecutive ten-time recipient of the Microsoft Most Valuable Professional award in the Windows Shell/Desktop Experience category, from 2003 to 2012. He loves to troubleshoot and write about Windows. Ramesh founded Winhelponline.com in 2005.

3 thoughts on “How to Add Icon to a Context Menu Item in Windows”

  1. How can I place an icon next to the delete (file; folder) entry?

    Appriciate your expertise, thanks in advance, greeting from Germany, Bure

    Reply

Leave a Comment