The Computer Oracle

On Windows 7, is there a command prompt line that can start cmd as an administrator?

-------------------------------------------------------------------------------
Become or hire the top 3% of the developers on Toptal https://topt.al/25cXVn
-------------------------------------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Puzzle Game 2

--

Chapters
00:00 Question
00:41 Accepted answer (Score 34)
01:42 Answer 2 (Score 11)
02:18 Answer 3 (Score 7)
02:36 Answer 4 (Score 4)
03:00 Thank you

--

Full question
https://superuser.com/questions/74564/on...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#windows7 #windows #commandline #administrator

#avk47



ACCEPTED ANSWER

Score 34


The runas command is the closest thing to what you're looking for:

runas /user:username cmd.exe

The format is runas, the username you want to run as, other options, and then the program you want to run.

If you're on a domain, you can use:

runas /user:DOMAIN\USERNAME cmd.exe

This can be run from the Run box ( Win+R ) or from a command window.

Note, however, that this is not exactly like sudo - you can't use it to elevate yourself, just run something as a different user. If you're already have administrative rights, a runas to your account will give you the same access as the regular command (unless, of course, you runas a different administrator account, which will grant those administrator's rights to the new shell).




ANSWER 2

Score 11


Try creating a shortcut to cmd.exe. Right Click > Properties. Click on Advanced button. And tick the box "Run as Administrator" and click OK.

Assign it a shortcut key if you want.

And you could also assign the default location for the CMD prompt to start in.. eg %CD%




ANSWER 3

Score 7


Another alternative is to click Start and type cmd, followed by Ctrl + Shift + Enter

Source: Microsoft Technet




ANSWER 4

Score 4


Use SuRun.

It works on Windows 8 as well. It runs the application in "admin" mode without a prompt, yet you have greater control on what applications are run (you can see it on the SuRun's control panel applet). It works great in a batch file too...




ANSWER 5

Score 2


If you want a command-line solution: download hstart from http://www.ntwind.com/software/hstart.html and extract hstart.exe or hstart64.exe to somewhere on your path. You can start an elevated command prompt with hstart /runas cmd or hstart64 /runas cmd.

But the fastest way (as noted in a comment for the question) is still to press Windows, type cmd and press Ctrl + Shift + Enter.