1. Home
  2. Windows Tips
  3. Windows 7 elevated command prompt in context menu

Windows Vista/7: (Elevated) Command Prompt In Context Menu

In Windows Vista/7, when you press SHIFT while right-clicking on a folder, drive, or in the blank space in an Explorer window, the extended context menu will show the option to ‘Open [a] command window here’. This will open up a Command Prompt window with the path you’re the residing in as current directory.

There’s an easy way to show this function into the default context menu as well. Just download the registry tweak below, double-click on it and accept the User Account Control prompt. Or you can add one yourself that opens a Command Prompt with administrator privileges. cmdprompt-01-context

Contents of registry file

Windows Registry Editor Version 5.00
;Show 'open command window here' on right-click without having to press shift
;Context-menu for folders
[HKEY_CLASSES_ROOT\Directory\shell\cmd]
"Extended"=-
;Context-menu for drives
[HKEY_CLASSES_ROOT\Drive\shell\cmd]
"Extended"=-
;For context-menu when you right-click in the empty/blank space within a folder
[HKEY_CLASSES_ROOT\Directory\Background\shell\cmd]
"Extended"=-

cmdprompt-02-cmdwindow

Open as Administrator

If you want to open an elevated Command Prompt window (with administrator privileges), you can use the second link below to add the entry in your context menu.

Download Command Prompt Context Menu Tweak

Download Command Prompt Context Menu (Administrator) Tweak

Credit for the elevated command prompt registry solution goes to BlogsDNA.

3 Comments

  1. To make the Administrator tweak work exactly the same way as the user-mode tweak, change it as follows:

    Windows Registry Editor Version 5.00

    [HKEY_CLASSES_ROOT\Directory\shell\runas]
    @=”Open command window here (Administrator)”

    [HKEY_CLASSES_ROOT\Directory\shell\runas\command]
    @=”cmd.exe /s /k pushd \”%V\””

    [HKEY_CLASSES_ROOT\Directory\Background\shell\runas]
    @=”Open command window here (Administrator)”

    [HKEY_CLASSES_ROOT\Directory\Background\shell\runas\command]
    @=”cmd.exe /s /k pushd \”%V\””

  2. The Context Menu (Administrator) tweak, as written, will display the option all the time, not just when you shift-click. To make it match the functionality of the original (which only displays when you shift-click) you should add two String values under “runas”, named “Extended” and “NoWorkingDirectory” (with no quotes). That’s consistent with the existing “cmd” key above it.