ShellExecute failed (2) error for Notepad++ on Windows 7 64bit

This is caused when you set Notepad++ to run as administrator on Windows 7.

Go into your registry as an administrator and search for notepad++.exe. Find the key under HKEY_CLASSES_ROOT that has an entry with the Edit with Notepad++ (or maybe Edit with &Notepad++) and delete the entire key. Right click and you should see that you no longer have that option.

Now we re-create it:

  1. Go to:

    HKEY_CLASSES_ROOT\*\shell
    
  2. Create a new key under shell called OpenWithNotepad and create a subkey under that called command.

  3. In the OpenWithNotepad key the default string is what you want the context menu item to be called. I set it to Open with Notepad++.

  4. Still in the OpenWithNotepad key, create a new string value called icon and set the value to path-to-notepad++.exe where path-to-notepad++.exe should be the full path, e.g. C:\Program Files\Notepad++\notepad++.exe.

  5. Under the command key edit the default string value and change it to "path-to-notepad++.exe" "%1" where path-to-notepad++.exe should be the full path, e.g. C:\Program Files\Notepad++\notepad++.exe.

When you right click this option it should now ask you properly for giving Notepad++ admin access to a file.

You still need to go to the properties for notepad++.exe and set it to run as an administrator.


This is a registry file that might help everybody:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\*\shell\OpenWithNotepad]
@="Edit with &Notepad++"
"icon"="C:\\Program Files (x86)\\Notepad++\\Notepad++.exe"

[HKEY_CLASSES_ROOT\*\shell\OpenWithNotepad\Command]
@="\"C:\\Program Files (x86)\\Notepad++\\Notepad++.exe\" \"%1\""

Copy it into Notepad and save it with a .reg extension. Close Notepad and double-click the file.


On my Windows 7 machine (32 bit) I set notepad++ to run as administrator, doing so caused the explorer shell extension to stop working with the "Shell Execute failed" error. Disabling this setting (right click, properties, compatibility...) resolved the issue. Maybe this is what is causing your problems? (Now all I need is an "Edit in Notepad++ as Administrator" shell extension....)