Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sometimes you may open a program that you want to run as an administrator, but you may already have opened it not as an administrator. Is it possible to elevate the privileges of an already running program in Windows 7 or do I have to close and restart as admin?

share|improve this question
3  
sudo for the win! –  Josh K Apr 9 '10 at 2:57
1  
@Josh K - er - How can you elevate an already running app using sudo ? –  Sathya Apr 9 '10 at 3:30
    
It's magical, you'd have to decode man sudo for more information. –  Josh K Apr 9 '10 at 3:58
2  
@Josh, if nothing else, you can always use pseudo ;) –  Tomas Lycken Jul 16 '10 at 22:44

1 Answer 1

up vote 17 down vote accepted

Unfortunately, no. A running process cannot be elevated to administrator privileges. I'm looking for a more authoritative source, but for now I have found:

  1. "Programs can't be elevated once they've already been launched..."

  2. "Code can only be elevated at process level when startup, which means that a running process cannot be elevated."

share|improve this answer
1  
This is absolutely untrue. The win32 API does support elevation of arbitrary applications that are already running, though the application in question must expose the functionality itself. This article and accompanying source code demonstrate how to accomplish this. It is conceivably possible that one could write an application to select and elevate other processes... –  Fopedush Dec 23 '13 at 19:13
5  
@Fopedush Although that article describes this technique as "self-elevating", what those example programs seem to actually be doing is launching a new instance of the process using ShellExecuteEx and the verb "runas". I don't think that achieves the OP's need to elevate a program that's already running (it will lose all of its state, for example). –  Stephen Jennings Dec 23 '13 at 23:47
    
when a non-elevated Total Commander 8.01 instance is blocked in an operation such as copying into a program files subfolder, it offers the possibility to "retry as administrator". Cannot this be extended to "foreign" (not self) processes? –  naxa Dec 27 '13 at 17:18
1  
@naxa I haven't used Total Commander, but I'd be willing to bet the "retry as administrator" option actually spawns a completely separate elevated process which performs the privileged work. Process Explorer does this when you choose "Show details for all processes", it launches a new elevated copy of itself and closes the unelevated copy. If that's the case, then programs need to be specifically written to know how to launch the second process correctly. –  Stephen Jennings Dec 27 '13 at 19:49
    
@StephenJennings You're completely right - the code sample I linked does in fact just relaunch with the runas command. I should have vetted the code in addition to the article before commenting. I had been under the impression that the WIN32 api did expose some kind of elevation mechanism - but perhaps I'm misremembering. I'll dig around and post again if I can find what I was thinking of. –  Fopedush Dec 31 '13 at 18:09

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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