How can I quickly open Command Prompt (cmd) with elevated credentials in Windows Vista?

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:

cmd elev 2 small

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.

cmd elev 3 small

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:

cmd elev 0 small

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.

  1. Click on the Vista logo (used to be the "Start" button.

  2. In the "Start Search" box type the name of the program you want to run as administrator. For example type CMD or CMD.EXE.

cmd elev 1 small

  1. 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.

  2. You will be prompted by the UAC warning window. Click on CTRL+C or click on the "Continue" button.

cmd elev 4 small

  1. Note that the CMD window has an "Administrator:" appended to the window title.

cmd elev 5 small

  1. You can now perform any administrative tasks you want.

cmd elev 6 small

Related articles

You might also want to read the following related articles: