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

99

40

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?

Jakub

Posted 2010-11-19T21:30:07.120

Reputation: 3 111

4Notepad++ works fine on my Win 7 x64. Try reinstalling – Sathyajith Bhat – 2010-11-20T02:33:09.737

-1 you should've included a keyword from the error in the title, then people will know before they've even clicked – barlop – 2011-09-11T19:20:16.983

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 – 2010-12-24T19:39:34.980

Answers

3

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?

bman

Posted 2010-11-19T21:30:07.120

Reputation: 426

3This is a really bad answer. It should be a comment, at best. – Brian Webster – 2017-05-07T22:25:51.977

7CCleaner isn't going to make a damn bit of difference here. The reinstall should fix it though,. – Billy ONeal – 2010-11-19T23:40:45.930

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 – 2010-11-21T03:50:39.430

2I tried the uninstall method, and fully cleaned the registry of all Notepad++ references. A new re-install worked. Strange... – Jakub – 2010-11-22T13:53:20.407

177

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.

Steve

Posted 2010-11-19T21:30:07.120

Reputation: 1 771

1@John Swaringen's answer is pretty easier than this manual operations, and worked for me. – Beytan Kurt – 2016-01-23T14:33:03.847

1This is correct. How do you remove the bad context menu item? – sammarcow – 2017-09-08T14:54:55.220

I was using a 32bit version of Notepad++ on Windows 10 62bit, for me the registry key was actually located at "HKEY_CLASSES_ROOT\CLSID{B298D29A-A6ED-11DE-BA8C-A68E55D89593" (had to search "Edit with &Notepad++"). After deleting this key and following the above steps I was able to use the Edit with Nodepad++ context menu while in an Administrator context. – Andrew – 2018-08-31T11:50:20.840

2This is the only answer that successfully lets me still use "Open as administrator" with Notepad++. – Allbite – 2011-12-24T17:01:46.670

Perfect, thank you; I really figured I was OOL here since I didn't have the time to spend right ATM to find what reg keys I needed through dint of effort, but "found it almost first on SuperUser by Googling" I fortunately had the time for... :) – shelleybutterfly – 2012-10-19T17:37:00.530

4Worked perfectly for me on Windows8 too. Thanks. – LDJ – 2012-12-07T08:16:34.413

Also works great for Windows Server 2012! – racingcow – 2013-02-01T16:27:37.300

10My registry entry was "Edit with &Notepad++" – Greg Woods – 2013-03-05T09:17:20.777

Is the name of the key important, or could we name it, say, EditWithNotepadPP, if we felt like it? – Ariane – 2013-06-05T04:17:16.620

1Also, 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 – 2013-06-05T05:14:19.953

GREAT!, THIS IS THE RIGHT ANSWER. btw, why the regular "Edit with Notepad++" that the installer adds does not work and this one does? – Alex Angelico – 2014-05-30T16:51:20.137

55

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.

John Swaringen

Posted 2010-11-19T21:30:07.120

Reputation: 651

2Make sure you copy first line as well. – CrnaStena – 2015-04-14T13:47:28.630

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. – 2016-05-19T20:36:47.413

Thanks work to me! I think a file "NppShell_06.dll" is bug to windows versions or other OS. – KingRider – 2016-06-28T11:57:30.420

Works on Win10 x64 – Harlandraka – 2017-09-03T21:50:18.060

Line 3 should be @="Edit with &Notepad++ (as Admin)"? – PotatoFarmer – 2018-06-21T17:42:58.053

This worked great for me after I uninstalled, cleaned the registry with CCleaner, and reinstalled the 64-bit Notepad++ on Windows 10 (64-bit) Professional. One other thing to mention (which should be obvious to most members of this SE): If you're using the 64-bit version of Notepad++, change the paths from Program Files (x86) to just Program Files (or wherever you actually installed the Notepad++ executable). i.e. "icon"="C:\\Program Files\\Notepad++\\Notepad++.exe" – G_Hosa_Phat – 2018-12-29T21:12:42.470

27

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

withakay

Posted 2010-11-19T21:30:07.120

Reputation: 441

This resolved the issue for me. – AaronLS – 2011-01-26T04:57:48.487

1This worked for me too. I was using windows 7 ultimate 64bit. – TryHarder – 2012-09-19T15:41:22.137

1The 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 – 2013-04-05T14:16:41.230

15

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

Jeff

Posted 2010-11-19T21:30:07.120

Reputation: 261

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. – RuntimeException – 2014-08-07T09:53:31.513

4

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.

Kana

Posted 2010-11-19T21:30:07.120

Reputation: 41

This was an easy fix. Started down the path of the regedit and went ugh. Tried this, totally worked. – jcollum – 2012-04-05T19:48:33.270

3

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

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

[HKEY_CLASSES_ROOT\*\shell\OpenWithNotepad\Command]
@="\"C:\\Program Files (x86)\\Notepad++\\Notepad++.exe\" \"%1\""
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{B298D29A-A6ED-11DE-BA8C-A68E55D89593}\Settings]
"ShowIcon"=dword:00000000

The second is for both items on the menu:

Windows Registry Editor Version 5.00

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

[HKEY_CLASSES_ROOT\*\shell\OpenWithNotepad\Command]
@="\"C:\\Program Files (x86)\\Notepad++\\Notepad++.exe\" \"%1\""
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{B298D29A-A6ED-11DE-BA8C-A68E55D89593}\Settings]
"ShowIcon"=dword:00000001

The third is to remove the Admin item entirely:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\*\shell\OpenWithNotepad]
"icon"=-

[HKEY_CLASSES_ROOT\*\shell\OpenWithNotepad\Command]
@=""

[-HKEY_CLASSES_ROOT\*\shell\OpenWithNotepad\Command]

[-HKEY_CLASSES_ROOT\*\shell\OpenWithNotepad]

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{B298D29A-A6ED-11DE-BA8C-A68E55D89593}\Settings]
"ShowIcon"=dword:00000001

Laurie Stearn

Posted 2010-11-19T21:30:07.120

Reputation: 344

1

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.

Carsten Salm

Posted 2010-11-19T21:30:07.120

Reputation: 11

1

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!

wasil

Posted 2010-11-19T21:30:07.120

Reputation: 11

1

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)

hjhndr

Posted 2010-11-19T21:30:07.120

Reputation: 11