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.

Possible Duplicate:
Elevate a running program to administrator (Windows 7)

Situation:

  1. I start a command prompt normally, without Administrator permissions, either accidentally by habit or intentionally because I don't plan on doing anything that requires elevated privleges.

  2. After some work, it turns out I actually do need to run something from the command line with elevated privileges.

Question:

  • How can I do this?

Parameters & Assumptions:

  1. I want to do this without going outside of the existing CMD window. (I know all about Ctrl+Shift+Enter in the Start Menu, and "Run As" in context menus. I know runas at the command line might be an option, but this would force creation of a new CMD window. I want to elevate an existing, non-privileged CMD window.)

  2. I do not want to enable or create any additional accounts.

  3. The built-in Administrator and Guest accounts (SIDs 500 & 501) are disabled, and either do not have passwords set or have very complex and human-unfriendly passwords configured. I want to keep them this way.

  4. My account is a member of the Administrators group.

  5. I'd rather do this with built-in tools only (Windows 7 Ultimate). Second preference would be Sysinternals or other Microsoft-provided add-ons. Third-party tools are a last resort option.

  6. While runas or sudo type functionality would probably be sufficient to solve this problem, I'd really like something that operates more like su - give me an elevated prompt from which I can run commands until I'm done with it.

  7. Ideally, I'd like this to be easily reversible - I want to be able to return to a non-elevated state within the same CMD window.

share|improve this question

marked as duplicate by Oliver Salzburg, Bob, Daniel Andersson, Tom Wijsman, studiohack Apr 30 '12 at 23:12

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1  
I don't think it's possible to elevate a process in-place, i.e. the process must be started with the desired elevation level. –  Bob Apr 24 '12 at 14:32
    
Have you checked superuser.com/questions/42537/… ? –  Horst Walter Apr 24 '12 at 14:36
    
Looks like Oliver's link might be the killer for this question, but the link Horst gives has an answer (not the accepted one, but further down) that points to some "Power Toys" which may be of use. Unfortunately, the Power Toy seems to be more like sudo when I'm really looking for su. –  Iszi Apr 24 '12 at 15:02
1  
Have a look at this, not sure if it is what you need...jpassing.com/2007/12/08/… –  Moab Apr 25 '12 at 1:05

1 Answer 1

Elevation spawns a new process, not elevating a existing process. I don't believe what you want is possible. UAC operates under a dual token method where even if you have the right to have elevated access, until you request it via UAC its not provided. Once requested its a new process.

share|improve this answer
    
I believe this is the case. –  Shinrai Apr 24 '12 at 14:46
    
I understand the new command prompt would run as a separate process. I just don't like the hassle of dealing with entirely separate windows. I was hoping there might be some way to make it behave more like the su command in Linux - sure, the actual session may be different, but there's no window-switching involved on the user end. –  Iszi Apr 24 '12 at 14:59
    
@Iszi I have a hard time coming up with a secure way to implement this. –  CodesInChaos Apr 24 '12 at 15:59

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