Drag and Drop File into Application under run as administrator

53

18

Whenever I have an application running (Visual Studio 2008, Notepad, etc.) under "Run as Administrator", I cannot drag and drop files from Windows Explorer into the application.

I've tried running Windows Explorer as administrator, but to no avail.

Is there a way to get drag and drop to work when my applications are under "Run as Administrator"?

Chris Dwyer

Posted 2009-10-22T19:45:05.903

Reputation: 2 185

2Eureka! So that was the cause. – MC Emperor – 2015-06-01T12:17:53.350

Answers

34

The problem is tied to how security permissions work. The ability to drag and drop from a normal applications to an elevated one would break the security model behind UAC. However, I'm unclear as to why a UAC prompt isn't shown, thus allowing for a temporary elevated operation (much like any linux user experiences every day). This is definitely something that Microsoft needs to work on. What troubles me is that this problem is already old. Vista behaved the same.

There's 2 things you can do (one ugly, one annoying)

  • Ugly: Disable UAC. But you lose all the extra security it offers.
  • Annoying: Use another File manager and run it too as an Administrator

Why another file manager? Because you can't actually elevate Windows Explorer. Despite seeing the option in the context menu of the Windows Explorer icon and a UAC prompt being displayed, the fact is Windows Explorer will not be elevated.

A Dwarf

Posted 2009-10-22T19:45:05.903

Reputation: 17 756

This worked beautifully for me -- I'm already using Directory Opus as a remote server (SFTP) file manager with ExpanDrive (remote volume mounter) and couldn't double-click or drag-files to my PSPad editor. Setting each component to Run as Administrator corrected my UAC nightmare. Thanks A Dwarf!! – Damion Hankejh – 2010-07-27T20:59:18.867

12Actually it can. If you selected the option Launch folder windows in a separate process and close all your folder windows, then the next one you launch the Run as Administrator option will work. Until all folder windows are closed, all folder windows will then be elevated. – Michael Urman – 2009-10-23T01:45:26.000

This is interesting, but how come it doesn't fix the drag and drop issue? – Chris Dwyer – 2009-10-23T18:11:38.893

What doesn't Chris? My answer or Micheal comment? – A Dwarf – 2009-10-23T18:14:09.140

1@Michael, under Windows-7 that doesn't work. Explorer can never be elevated to my knowledge. – A Dwarf – 2009-10-23T18:16:31.023

@ADwarf, Michael's comment. I unchecked your answer because I thought Michael was on to something, but I will restore your check. I knew about the Ugly solution, and I don't want to do the Annoying solution, so I'll just live with it. :) – Chris Dwyer – 2009-10-23T18:54:36.263

He got me curious too. But although I was pretty sure it wouldn't work, I did as suggested and even logged off and logged back on to allow Explorer the opportunity to restart. However the good news is that this is certainly an oversight. Explorer doesn't need to or ever gets elevated. Instead it's the operations inside Explorer like copying, moving, renaming a file. You see this happen when you get an UAC prompt from within Explorer when trying to do certain actions. They clearly forgot(?) to add drag and drop operations to this list of actions that may generate an UAC prompt. – A Dwarf – 2009-10-23T19:13:31.203

2I ran 7-Zip with admin privileges and was able to drag a file from that app to another app with admin privileges. – KClough – 2009-11-26T19:11:00.400

7

This is a workaround according to ADwarf "Annoying" solution: open Notepad with "Run as Administrator". Click on open in file menu and enter * in file name and press enter. Now you can drag files from there to your app. Notepad open browser doesn't support multiply file selection, but you can use other programs in the same way to use drag and drop!

Salar

Posted 2009-10-22T19:45:05.903

Reputation: 171

I do wonder what's more annoying: going through this every morning, keeping notepad open and navigating to the folder you need every single time followed by a drag-and-drop operation, or clicking "Open" in the target program, navigating to the folder you need and than just double-clicking it. In every way you put it, it's a major PITA! – Grimace of Despair – 2013-07-22T14:18:27.187

3

Windows 7:

Launch PowerShell using Run As Administrator

Type:

taskkill /f /im explorer.exe

start-process explorer.exe

or launch cmd (Command Prompt) using Run As Administrator

Type:

taskkill /f /im explorer.exe

start explorer.exe

All your new Explorer windows will now be elevated and you can drag and drop from them into other elevated applications. I tested and verified this prior to posting.

BJGGut3

Posted 2009-10-22T19:45:05.903

Reputation: 31

This worked for me. Thanks! I'm on Windows 8, dealing with dragging and dropping to an app that was spawned by Visual Studio 2013 (which is running as admin). – Owen – 2015-02-06T17:15:40.580

Do you recommend this to be run automated at startup? – Oliver M Grech – 2017-05-23T17:56:54.660

2This doesn't work. Tried it and still the same issue. – Thierry – 2014-01-06T17:37:30.393

1

There was an update to Visual Studio 2005 published 2 years ago that fixed many UAC problems on Vista, and that same update fixes the same problems on Windows 7.

It is not a critical update so you wouldn’t get it automatically, and it was not included with VS2005 SP1. They’re not actively publicizing this update now b/c they just want everyone to go to VS2008. So chances are you don't have it.

Explanation at http://msdn.microsoft.com/en-us/vstudio/aa948853.aspx?lcid=1033

Download at http://www.microsoft.com/downloads/details.aspx?FamilyID=90e2942d-3ad1-4873-a2ee-4acc0aace5b6&displaylang=en

Here's what that update fixes, when running Visual Studio in normal user mode with UAC turned on:

  • Drag/drop files from an explorer window
  • Launching VS (as a normal user) by launching shortcuts to solutions/projects or associated file types
  • DLL/EXE registrations still fail (rightly so, since those are system-level changes.)

If you're running VS as an administrator, the window is still locked down to drag/drop and shortcuts, and DLL/EXE registrations work correctly without having to completely turn off UAC.

Note: VS will still warn you about administrator mode when you launch it, but now you can probably ignore that warning permanently.

John M. Black

Posted 2009-10-22T19:45:05.903

Reputation: 41

But this is for VS 2005...? – Chris Dwyer – 2010-08-31T22:15:50.683

Yes, VS 2005. Sorry I wasn't clear. I updated my original post with more information. – John M. Black – 2010-09-01T13:34:26.363