On Windows 7, is there a command prompt line that can start cmd as an administrator? [duplicate]
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).
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%
Another alternative is to click Start and type cmd, followed by Ctrl + Shift + Enter
Source: Microsoft Technet