23

If I have Notepad++ running as administrator, I can't drag files from explorer on to it (they are rejected with the 'stop' cursor) and if I try to use the explorer extension right click 'Edit with Notepad++' it throws an error.

Opening the files using the Notepad++ 'Open' dialog, or even double clicking them in Explorer works as it should. (Note double clicking is not a solution as very few of the files I want to open are default to Notepad++)

I have UAC set to 'never notify'.

Using the hack where UAC 'admin approval mode' is disabled fixes the issue, but kills the ability to use Metro apps.

3
  • Why are you running Notepad++ as admin?
    – kinokijuf
    Jun 4, 2014 at 20:50
  • 1
    I'm not any more but at the time of the question it was to easily edit the hosts file (something I don't need to touch as often now)
    – Dark
    Jun 5, 2014 at 0:08
  • 1
    It also runs as admin after it updates a plugin. I ended up here before and then I looked at the window title bar. Yup Admin. Fix: Just restart it.
    – CAD bloke
    Jul 1, 2014 at 12:12

6 Answers 6

34

Lower-integrity processes can't pass messages to higher level ones.

You'll find that this is the case for any elevated process since Windows Vista onward.

Processes run under certain security access tokens and integrity levels. Explorer runs under your user account's restricted token with a medium integrity level, and when you elevate a process by running as administrator, it will use a different, unrestricted security token with a high integrity level.

Part of the security overhaul that came with Vista was User Interface Privilege Isolation, which prevents lower level processes from sending messages to higher level ones (because the messages may be malicious, as in the case of shatter attacks).

So in this case, Windows won't allow Explorer to send the drag and drop message to Notepad++ (it actually returns "success" but drops the message).

For more detailed information about access tokens, integrity levels and UIPI, see Windows Integrity Mechanism Design.

8

Louis explained why you can't drag from non-admin-mode explorer into admin-mode Notepad++, and magicandre told you how get around it by running explorer in admin mode.

After experiencing a similar problem myself, I have to ask further: why are you running Notepad++ in admin mode in the first place? In my case it was because the HTML Tidy plugin which I like to use has to update a cfg file in Notepad++'s Program Files folder in order to work; and Windows 8 has Program Files locked down like crazy.

So in the end I unlocked the Notepad++ Program Files folder as outlined here: http://forums.auran.com/trainz/entry.php?115-Removing-the-security-restrictions-from-a-folder-in-the-Program-Files-folder

Then I could happily run Notepad++ as a regular user, and then I could drag & drop or use the ever-handy context menu again, from non-admin-mode explorer into non-admin-mode Notepad++.

I hope this helps you in some way.

2
  • 1
    When I ran into this problem, this is the real answer that I was looking for. I don't know what happened, but NPP didn't get like this until the most recent update a couple of days ago.
    – darkpbj
    May 30, 2014 at 14:56
  • 2
    As a software developer and systems admin, I often have to edit files with varying permissions/ownership. Running my editor as an administrator is far more convenient than modifying permissions before and resetting after. Mar 23, 2017 at 20:02
4

Louis gave you the correct technical answer, here is workaround. You can start the Explorer with admin rights with a hack and now you should be able to drag & drop files.

2

In most cases (where you have read- but not write-access as regular user) there is a better approach than running Notepad++ as admin:

Install the plugin "Save as admin" (see Notepad++ plugin manager).

Now just run Notepad++ as a regular user and open the files you want to edit. As you have read-access this will work without problems.

Now every time you try to save a file you don't have write permissions the "Save as admin" plugin will elevate the privileges for saving. Therefore if you now execute the save command an UAC dialog will be displayed and if you select "yes" on that dialog the file will be saved using admin permissions.

1

Another workaround is to use the standalone (zipped) version of Notepad++ instead of the installer version.

  1. Uninstall/Delete Notepad++
  2. Go to the Notepad++ download page and download the .zip or .7z package (not the exe)
  3. Unzip the contents of that package somewhere inside your user directory

Drawback to this workaround is you will of course need to create your own shortcuts and manually update your default text editor if desired. And you won't have the context-menu entry for notepad unless you hack it in there yourself.

0

Changing permissions on an elevated task installed by the elevated installers service is difficult at best. Windows 7 x64. I took the path suggested.. I used Control Panel » Programs and Features to uninstall Notepad++.

Then went to the Notepad++ website and downloaded the zipped version with no installer.

Then used Windows Explorer to extract all files to the path C:\Program Files (x86)\Notepad++ – the same as the original installer path.

Then I created a folder group in the All Programs section of the Start menu.

  • Click Start menu
  • Right click All programs
  • Open All Users
  • Click Programs
  • Right click, New » Folder, enter Notepad++

Then I used another Explorer window to create a shortcut to notepad++.exe, then dragged and dropped that shortcut into the C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Notepad++, answering the Destination Folder Access Denied dialog box with Continue.

Next disable the AutoUpdate function for Plugins on Notepad++, like most software these days "Updates" are often "hostile" and carry a real degree of risk. For an application I prefer to know when an update occurs.. it is not a service so it is riskier to trust developers to properly test their code.

Go » Plugins » Plugin Manager » Show Plugins » Settings (lower left corner), there uncheck Notify of plugin updates at startup.

Now I can drag and drop again.

Now the Notepad++ process is not being run as an elevated task and other applications like Explorer are allowed to drag and drop files on the open Notepad++ program window to open them.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .