Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Is it possible to switch from normal mode to administrator mode in command line? I don't want to open command line by right clicking and selecting "run as administrator". Thanks

share|improve this question

5 Answers 5

Or from within Powershell:

Start-Process powershell -Verb runas
share|improve this answer

The answer is no. The "full administrative token" is associated with an .EXE when it's launched. You need to start a new CMD.EXE to get full-admin privs. To make UAC a bit more bearable, you can enable "auto-admin approval" through group policy.

share|improve this answer
    
To make UAC more bearable you'd have to disable it entirely. –  Ansgar Wiechers Sep 14 '12 at 20:06
1  
@AnsgarWiechers: I hope this comment was not serious. It seems a bit lame to encourage anyone to disable UAC completely. –  Sk8erPeter Dec 31 '13 at 10:15
    
@Sk8erPeter I am quite serious about this. If you're aiming for a secure system: disable UAC and use separate accounts (an admin account for administrative tasks and an account without administrative privileges for day-to-day work). UAC is just a lame workaround that Microsoft invented so that their customers can remain members of the administrators group all the time without actually having admin privileges all the time. –  Ansgar Wiechers Jan 3 at 10:26
    
@AnsgarWiechers: it's funny that you call UAC a "lame workaround" when it solves the problem of users logged in all the time with a user that is a member of the administrators group. If you did it on XP, all the programs could run with elevated privileges (so they could harm your system too). Now if you DO NOT disable UAC (which is recommended) it's only possible if you explicitly give them these privileges in the UAC popup (if being logged in as part of the admin group, you just don't have to type in the password all the time). Calling it lame is like calling Linux's sudo a lame workaround. –  Sk8erPeter Jan 4 at 11:42
1  
@AnsgarWiechers: I agree, this is not the right place to discuss it. I think a right closure of this debate can be that disabling UAC entirely is a very lame thing to do. ;) –  Sk8erPeter Jan 4 at 13:36

You can have a shortcut to cmd.exe and just modify the Advanced properties tab to "Run as Administrator".

share|improve this answer

How about this:

runas /user:administrator cmd.exe
share|improve this answer
    
To my understanding, this requires the actual Administrator account to be active (Enter the password for administrator:). It is not identical with simply running the command prompt with elevated privileges. –  Oliver Salzburg Sep 14 '12 at 14:33

You can't really "switch" between the two modes, but there are some 3rd party tools that let you launch programs from the command line in the elevated admin. Provided you drop them into a working path, you could, for example, use "elevate cmd" from the start menu or from an existing command prompt to start a new session in the elevated mode.

share|improve this answer

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.