5

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.

Iszi
  • 14,163

1 Answers1

4

Elevation spawns a new process -- it doesn't elevate an 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.

Varaquilex
  • 3,846
edusysadmin
  • 2,226