Dela via


Windows Vista Secret #10: Open an Elevated Command Prompt in Six Keystrokes

User Account Control is, as I mentioned in secret #4, an important part of the security protection that Windows Vista offers. For any user with administrative credentials, you can always execute a process with full admin rights by right-clicking on the executable or shortcut and choosing "Run as Administrator".

For myself, I regularly want to open an admin-level command prompt, and it's a distraction to have to move my hands off the keyboard to go through the elevation contortions. So I was delighted to find a little keyboard shortcut for launching an elevated process. Simply press Ctrl+Shift+Enter from the search bar on the start menu with a selected application, and that triggers elevation.

For example, to launch an elevated command prompt, simply press the Win key; type cmd; press Ctrl+Shift+Enter; and then hit Alt+C to confirm the elevation prompt. Six keystrokes to an elevated command prompt!

(Once I've got an elevated command prompt, I always like to execute color 4f as my first input so that this console window is visually differentiated from other non-elevated windows.)

Comments

  • Anonymous
    November 02, 2006
    Tim Sneath , one of the Windows Vista Technology Evangelists, has a great series going on his blog -

  • Anonymous
    November 02, 2006
    I use Windows Vista Secret #5: I added a command prompt  shortcut to the quicklaunch and in it's properties, Compatibility tab checked "Run this program as an administrator." So it's two keystrokes: Win+4, Alt+C. :-)

  • Anonymous
    November 04, 2006
    Family morning at the Gentiles means the whole family watching Radiohead from 1994 while waiting for

  • Anonymous
    November 04, 2006
    I do it exactly the same way I do in XP.  Windows+R then type 'cmd' and hit enter, as everything executed from the Run menu has elevated permissions...

  • Anonymous
    November 04, 2006
    Hi Simon - nice to hear from you! Actually, this doesn't work for me, at least not in the standard configuration. The telling difference is the lack of an "Administrator:" prefix to the title of the command window. Maybe you have UAC disabled?

  • Anonymous
    November 05, 2006
    The comment has been removed

  • Anonymous
    November 05, 2006
    Ok, you are right, you only get what I was describing when you turn off UAC.

  • Anonymous
    November 07, 2006
    This is unacceptable, thus I changed the policy to "elevate without prompting" My normal method is to have cmd prompt on top of the Start Menu, then press Win, down arrow (select the top item), enter. This still works in Vista if above policy change is made to "User Account Control: Behavior of the elevation prompt for standard users"

  • Anonymous
    November 09, 2006
    The comment has been removed

  • Anonymous
    November 12, 2006
    Well it has been a long, long, difficult project, but come tomorrow around 8:30 my time, all of my long

  • Anonymous
    November 15, 2006
    cmd.exe? I think you means powershell.exe ;)

  • Anonymous
    November 23, 2006
    I'm loving Windows Vista RTM. I'm actually considering moving my main development PC over - just need to be certain that everything I use will work just fine - in the meantime, I'll stick with it running from my Core...

  • Anonymous
    December 04, 2006
    I'm using the RTM, and this doesn't work for me. I've tried "cmd" and "cmd.exe". In both cases, pressing SHIFT+ENTER does nothing (Start menu vanishes, but no command prompt appears).

  • Anonymous
    December 08, 2006
    I was able to elevate the SDK Command Prompt shortcut with the "CTRL+SHIFT+ENTER" when focused on it in the start menu. btw - Great Tip

  • Anonymous
    December 20, 2006
    Via Tim Sneath I've learned that you can start an elevated command prompt from the Start Menu. Press

  • Anonymous
    January 13, 2007
    A question: why doesn't it work for me and also, even when I click run as administrator it doesn't work, it shows me the hourglass and does not do anything.?

  • Anonymous
    July 30, 2007
    Tim Sneath hat einige sehr hilfreiche Windows Vista Secrets veröffentlicht die euch das Leben mit dem...

  • Anonymous
    October 20, 2007
    Family morning at the Gentiles means the whole family watching Radiohead from 1994 while waiting for

  • Anonymous
    December 03, 2008
    Family morning at the Gentiles means the whole family watching Radiohead from 1994 while waiting for the Starbucks to come... Software Development Ayende points to this great list Nine Things Developers Want More Than Money and asks what excites you as