Windows 7 Error: Is this command correct?

ShellExecute failed (2): Is this command correct? "C:\Program Files (x86)\Notepad++\notepad++.exe [location of file to edit]

I seem to have some issue with RIGHT CLICK > Edit with Notepad ++. This is on a fresh install of Microsoft Windows 7 Professional 64-Bit.

I can't seem to find any notice of this error? Or is this just some Windows 7 config issue?

  • 4
    Notepad++ works fine on my Win 7 x64. Try reinstalling
    – Sathyajith Bhat
    Nov 20, 2010 at 2:33
  • I attempted installing to Program Files instead of the x86 program files directory, this did not solve the problem. I think the issue is that the shell extension is running from a DLL that does not have administrative access. I believe it to be NppShell_04.dll so if we figure out how to tell Windows 7 give that administrative access to run, then we are golden.
    – Steve
    Dec 24, 2010 at 19:39
  • -1 you should've included a keyword from the error in the title, then people will know before they've even clicked
    – barlop
    Sep 11, 2011 at 19:20

11 Answers 11


I have Windows 7 64 Bit and I'm working with Notepad++ for more than a year on different Windows 7 64 Bit installation and I never seen such an error. Are you tried complete uninstall, run CCleaner, and installing Notepad++ again?

  • 7
    CCleaner isn't going to make a damn bit of difference here. The reinstall should fix it though,. Nov 19, 2010 at 23:40
  • I've tried a re-install, thats the funny thing. I am not sure what the issue is, I will try an uninstall, check registry entries and do a full install again.
    – Jakub
    Nov 21, 2010 at 3:50
  • 3
    I tried the uninstall method, and fully cleaned the registry of all Notepad++ references. A new re-install worked. Strange...
    – Jakub
    Nov 22, 2010 at 13:53
  • 5
    This is a really bad answer. It should be a comment, at best. May 7, 2017 at 22:25

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:

  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.

  • 4
    This is the only answer that successfully lets me still use "Open as administrator" with Notepad++.
    – Allbite
    Dec 24, 2011 at 17:01
  • 4
    Worked perfectly for me on Windows8 too. Thanks.
    – LDJ
    Dec 7, 2012 at 8:16
  • 10
    My registry entry was "Edit with &Notepad++"
    – Greg Woods
    Mar 5, 2013 at 9:17
  • 1
    Also, how could we combine this with a method to shut off UAC warnings? Everything I can find uses shortcuts; however this registry fix points directly to the executable. Because let's be frank, it's almost worse to right-click "Edit with Notepad++" a 10 files and then deal with 10 UAC prompts than to save everything to a temporary folder and then moving them to the destination, as is necessary without running Notepad++ as administrator.
    – Ariane
    Jun 5, 2013 at 5:14
  • 1
    @John Swaringen's answer is pretty easier than this manual operations, and worked for me. Jan 23, 2016 at 14:33

This is a registry file that might help everybody:

Windows Registry Editor Version 5.00

@="Edit with &Notepad++"
"icon"="C:\\Program Files (x86)\\Notepad++\\Notepad++.exe"

@="\"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.

  • 2
    Make sure you copy first line as well.
    – CrnaStena
    Apr 14, 2015 at 13:47
  • This worked for me in Win8 x64. It gave me a duplicate though, so I had to reinstall Notepad++ first, and then disable the Context Menu option in the installer. Thanks.
    – Aske B.
    May 19, 2016 at 20:36
  • Thanks work to me! I think a file "NppShell_06.dll" is bug to windows versions or other OS.
    – KingRider
    Jun 28, 2016 at 11:57
  • 2
    Works on Win10 x64 Sep 3, 2017 at 21:50
  • 1
    Line 3 should be @="Edit with &Notepad++ (as Admin)"? Jun 21, 2018 at 17:42

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....)

  • This resolved the issue for me.
    – AaronLS
    Jan 26, 2011 at 4:57
  • 1
    This worked for me too. I was using windows 7 ultimate 64bit.
    – TryHarder
    Sep 19, 2012 at 15:41
  • 1
    The same happended to me when I pinned Notepad++ to the taskbar and checked Shift+Right click -> Properties -> Compatibility -> Run this program as an administrator. Unchecking and selecting Shortcut -> Advanced -> Run as Administrator helped.
    – too
    Apr 5, 2013 at 14:16

I recently upgraded Notepad++ and I started getting this "ShellExecute failed" error when trying to use the "Edit in Notepad++" context menu feature.

While I found many reports of this error online, none of the solutions that I saw worked on my machine.

Here are the steps I used to resolve the problem:

  1. Right click on notepad++.exe in the Notepad++ program folder.
  2. Select the Properties menu item.
  3. Select the Compatibility tab.
  4. When “Run this program as an administrator” is enabled just for the current user, you can disable by clicking on the checkbox.
  5. Otherwise, "Run this program as an administrator” is enabled for all users and you have to click on “Change settings for all users” first, then you can disable the option.

I created an image for each of these scenarios and attached them below.

I highlighted "Run this program as an administrator” in both images and highlighted the “Change settings for all users” button in green for the scenario where the option was enabled for all users.

RunAsAdmin CurrentUser Scenario RunAsAdmin AllUsers Scenario

  • Thanks a lot Jeff. That fixed it. Give it a shot before playing around with Registry. If this does not work, then jump to Registry fixing. Aug 7, 2014 at 9:53

Uninstall, clean registry and re-installing didn't work for me. Neither was I running in a compatibility mode so that could not have been my issue.

What the issue was for me is that I checked the option "Run this program as an administrator" in the compatibility tab. I had turned this option on to be able to save e.g. the hosts file. After unchecking this I finally could rightclick and edit files using NotePad++ again.

  • This was an easy fix. Started down the path of the regedit and went ugh. Tried this, totally worked.
    – jcollum
    Apr 5, 2012 at 19:48

This adds to @John Swaringen's post above with the additional identifier for the Admin menu item. Before applying these changes it's important to ascertain that N++ is indeed installed at C:\Program Files (x86)\Notepad++. If not, then the correct install path will have to be substituted for it in the appropriate section of the following snippet(s).

On show are three files with links to them on the home drive- or copy the code to a text file with .reg extension:

The first is for the Admin menu item only:

Windows Registry Editor Version 5.00

@="Edit with &N++ [Admin]"
"icon"="C:\\Program Files (x86)\\Notepad++\\Notepad++.exe"

@="\"C:\\Program Files (x86)\\Notepad++\\Notepad++.exe\" \"%1\""

The second is for both items on the menu:

Windows Registry Editor Version 5.00

@="Edit with &N++ [Admin]"
"icon"="C:\\Program Files (x86)\\Notepad++\\Notepad++.exe"

@="\"C:\\Program Files (x86)\\Notepad++\\Notepad++.exe\" \"%1\""

The third is to remove the Admin item entirely:

Windows Registry Editor Version 5.00






in case you did not get it fixed yet, i had the same issue and tried all the above. I had told Notepad++ to start in compatibility mode and got that error. After i turned it off, everything went back to normal.


In my case thing that helped was to install Notepad++ in regular "Program Files" directory, not in "Program Files (x86)". Path is just messed up :)

Hope it helps!


I've had persistent problems with Notepad++ (on 5.9) in regards to opening/editing files via explorer interface (both direct click to open and right-click to edit..etc). The solution for me has been to install Notepad++ in C:\Program Tools\Notepad++\ - if I try any of the "official" install locations Notepad++ only opens things right when run in admin mode (which is a UAC pain in the arse if you'll pardon my french)


For those ending up with duplicate entries after following John Swaringen's or Laurie Stearn's, like Aske B, this is because these answers are incomplete and don't deal with the removal of the default entry. If you compare them to Steve's answer, they pick up where he says "Now we re-create it" and you still have to do the stuff he says before that to remove the default entry. You don't have to reinstall N++, though you can if you feel more comfortable doing that. Unfortunately, while a .reg file could be created to remove the default entry automatically, to make it easier for those who prefer not to do manual registry edits, it's not likely to work well, since it's probably in a different location for different people. Mine, for example, was in [HKEY_CLASSES_ROOT\CLSID{B298D29A-A6ED-11DE-BA8C-A68E55D89593}].

Another tidbit: If you want to change the location of the entry in the right-click menu, whether to make it be right under the top/default "Open" or "Open with" entry" (and keep in mind it may be when you create it but that may change later if/when another program creates a new entry, so you may want to just do this now to prevent that from happening later) or to move it down closer to the default entry's position (toward the bottom of the top section), you do this via the key name. For example, keys in this order will result in context menu entries in the same order:

[HKEY_CLASSES_ROOT*\shell\!EditWithNotepad] [HKEY_CLASSES_ROOT*\shell\AEditWithNotepad] [HKEY_CLASSES_ROOT*\shell\AnotherProgram] [HKEY_CLASSES_ROOT*\shell\EditWithNotepad] [HKEY_CLASSES_ROOT*\shell\OpenWithNotepad] [HKEY_CLASSES_ROOT*\shell\SomeOtherProgram] [HKEY_CLASSES_ROOT*\shell\ZOpenWithNotepad]

Keep in mind these are merely the key names, and they have no impact on the entries' text, only their positions. The actual text of the entry is determined by the "(Default)" name provided in the right pane. And, of course, you can use this to change the order of the other entries as well (top section only, though I'm sure the other sections can be tweaked elsewhere in the registry, plus I believe there are programs specifically for modifying the context menu.

Not the answer you're looking for? Browse other questions tagged or ask your own question.