How to Fix “ShellExecute failed (2): Is this command correct?” on Notepad++

Problem:

When you click right-click->Edit with Notepad ++ and get the error “ShellExecute failed (2): Is this command correct?” as seen below:

Notepad++ Extension- Error ShellExecute

 

Solution of ShellExecute Failed (2) Error:

This problem seems to happen after setting Notepad++ to run as administrator on Windows.

To fix it, we will do the following:

1. Open the registry by pressing Win+R (window key and the “r” keys), following by entering “regedit” without the quotes and press enter

2. Go to the HKEY_CLASSES_ROOT key as shown below

regedit

3. Search for “notepad++.exe” under that key which has an entry Edit with Notepad++ or Edit with &Notepadd++ (Below is an example)

Edit with key

 

4. Once found, delete the whole key (it is recommended to take a backup first using right-click->Export first)

If done correctly, the “Edit with Notepad ++” would disappear like shown in the below before/after figure.

Context Menu

Now we need to recreate it but a working version this time.

5. Go to

HKEY_CLASSES_ROOT\*\shell

6. Create a new key under shell called OpenWithNotepad and create a subkey under that called command as seen below:

OpenWithNotepad

7. Inside the OpenWithNotepad key, set the (Default) string variable to “Edit with Notepad ++”

8. Create a new string variable called icon and set the value to path-to-notepad++.exe where path-to-notepad++.exe is the full path, e.g. C:\Program Files\Notepad++\notepad++.exe. In my case, I had to set it to C:\Program Files (x86)\Notepad++\notepad++.exe since I am running a windows 64-bit version.

9. Inside the command key, set the default string as "path-to-notepad++.exe" "%1" where path-to-notepad++.exe is the full path as we did in step 8

You are done, now you should find a working “Edit with Notepad++” that does not throw out the error in the beginning of this post.

Found this post useful?

Subscribe to our RSS feed, follow us on Twitter or help us grow by sharing our content using the buttons below

This entry was posted in Software, Technology, Windows and tagged , , , . Bookmark the permalink.

22 Responses to How to Fix “ShellExecute failed (2): Is this command correct?” on Notepad++

  1. Rafael says:

    Thank you so much!

  2. mauricio says:

    thanks you, the problem has been fixed.

  3. Zyre says:

    You. Are. Genius. Thank you so, SO very much!

  4. Nicholas says:

    Thanks pal, this worked.

  5. LazySmerf says:

    Great write up !! Have been dealing with this on windows 10 for a while.

    just a little note, add some images for the last few steps this might help some more people !

    • Thanks for the kind words LazySmerf.

      Regarding adding images for the last few steps, I think that is a great idea and will do so as soon as possible.

      Great feedback!

  6. nunyabidness says:

    Fire the freaking imbeciles that do your captcha. I’m not retyping my entire freaking entry because it timed out in the #$%$%#% time I typed it.

    F*** that’s designed by morons.

    It’s not the timeout that’s retarded. It’s that it doesn’t do it with a popup AND doesn’t save the page contents for when you hit “back”. So you lose anything you haven’t copied to the clipboard.

    AND the time limit is preposterously short — what, 1, 2 minutes, tops? What, is this twitter? Someone should be fired.

    • No need to use foul language, I had the Captcha enabled to protect the blog from being flooded by spam from automated bots.

      In any case, yes the timeout is 120 seconds (2 mins) however no user has pointed it out as a problem in the past and i have not personally faced an issue before. However, to avoid this issue in the future I have bumped it up to 10 mins, hopefully that will avoid users such as yourself from facing this problem in the future.

      P.S You could have calmly pointed out the issue and it would have been handled as well. Being rude accomplishes nothing except negatively reflect on your public image (not that you were brave enough to leave your actual name or email but that’s up to you)

  7. Joy says:

    The error has gone away, but now I have to give the administrators password everytime, The error had initially appeared when I had selected the “run as administrator” in the properties of Notepad++.exe.

  8. Ted says:

    Thank you this worked for me. Too bad Notepad++ doesn’t fix this on one of their updates. On that note, too bad they don’t fix their updates that fail because of elevation

  9. Ted says:

    Actually it doesnt work

    I would put more information here but the CAPTCHA timed out.

  10. NoName says:

    Thanks!!

  11. null says:

    Merci beacoup ! 😀

  12. notepadGuy says:

    what happens if I dont have the notepadd++ under HKEY_CLASSES_ROOT ?

  13. Mikaciu says:

    Battlefield.4-RELOADED.torrent 😀 😀 😀
    Thanks for the advice, but you may need to redo your screenshot, maybe.

  14. Athelas says:

    Thanks so much! It’s very useful!

  15. Freelog says:

    Thank you very much!

  16. phil dommer says:

    Absolutely wonderful!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.