Last Update: Sep 24, 2024 | Published: Jan 07, 2009
How can I quickly open Command Prompt (cmd) with elevated credentials in Windows Vista?
As you’ve learned so far, Windows Vista has the built-in ability to automatically reduce the potential of security breeches in the system. It does that by automatically lower the administrative rights of users that are part of the local administrators group, and forces them to run applications and commands like they were regular users with no administrative privileges.
For example, if you ran CMD as a user that was a part of the Local Administrator’s group, or even as the Administrator himself, you’d get a nice Command Prompt window:
Now try to run any command that requires administrative rights, for instance use the following command as a test:
net user administrator MyNewP@ssw0rd!
Lamer note: This command will change the administrator’s password to "MyNewP@ssw0rd!", don’t run it, it’s just an example. And if you do run it, change the password to whatever string you want. Don’t come crying that you can’t logon to the computer anymore after changing the password!
Note that the command refuses to run because of permission issues.
So how do we perform administrative tasks in Windows Vista?
In order to gain your administrative rights you need to use the RUNAS command from the command prompt, or from the Graphical User Interface (GUI) by right-clicking the required application and selecting the "Run as administrator" option:
After selecting that option you need to pass the UAC prompt by pressing "Continue" (unless you’ve already disabled it. Read What’s User Account Control in Windows Vista? and Disable User Account Control in Windows Vista for more info)
Instead of using the RUNAS command from the command prompt or the GUI "Run as administrator" option you can perform the following trick:
Note: This tip seems to only work with .EXE files, and does not work for shortcuts.
Click on the Vista logo (used to be the "Start" button.
In the "Start Search" box type the name of the program you want to run as administrator. For example type CMD or CMD.EXE.
Do NOT hit ENTER. Instead hit CTRL+SHIFT+ENTER. It seems that this key combo triggers user account elevation and is identical to the RUNAS command or the GUI "Run as administrator" option.
You will be prompted by the UAC warning window. Click on CTRL+C or click on the "Continue" button.
Note that the CMD window has an "Administrator:" appended to the window title.
You can now perform any administrative tasks you want.
You might also want to read the following related articles: