Adding an Elevated “Command Prompt Here” for Folders and Drives Context Menu

Adding an "Elevated Command Prompt" here for Folders and Drives context menus in Windows Vista is pretty much the same way as you do in Windows XP. You will need administrative privileges (which means Elevated Privileges for Windows Vista) to add the entries in the registry because this is a system-wide change.

The "Elevated Command Prompt" here context menu is a very useful because when you right-click on a folder to select "Elevated Command Prompt" then the Command Prompt window will open with elevated permission at that folder’s location. For example, if you right-click on "c:\program files\program.folder" then the Command Prompt will open with elevated permissions at "c:\programs files\program.folder".

NOTE

To enlarge the images, simply click on the images you would like to view. With Internet Explorer 7, you can right-click on the image to select Open in New Tab.

    

CAUTION

Editing the Windows Vista registry can cause serious issues such as system instability when editing/deleting the wrong entries. Please use the Registry Editor with extreme caution.

CAUTION

Before making any changes to the Windows Vista Registry, please backup your Windows Vista Registry by creating a System Restore point using the direction from "Create a System Restore Point".

To Add "Command Prompt Here" to a Folder or Drive Context Menu with Elevated Privileges – Manual Method

NOTE

To enlarge the images, simply click on the images you would like to view. With Internet Explorer 7, you can right-click on the image to select Open in New Tab.

For Folders

  1. Open the Registry Editor with Elevated Privileges, refer to "Opening the Registry Editor with Elevated Privileges" blog article for instructions.
  2. Navigate to:

    HKCR\Directory\shell

  3. Create a new key by right-clicking "shell" to select New > Key. Name the new key RunAs.
  4. Double-click (default)located at:

    HKCR\Directory\shell\RunAs

  5. Enter the following in the Value Data filed:Elevated Command Prompt
  6. Create a new key by right-clicking "RunAs" to select New > Key. Name the new key command.
  7. Double-click (default)located at:

    HKCR\Directory\shell\RunAs\command

  8. Enter the following in the Value Data field:

    cmd.exe /s /k pushd "%V"

    [HKCR\Directory\shell\RunAs]
    Name: (default)
    Type: REG_SZ
    Data: Elevated Command Prompt

    [HKCR\Directory\shell\RunAs\command]
    Name: (default)
    Type: REG_SZ
    Data: cmd.exe /s /k pushd "%V"

For Drives

  1. Open the Registry Editor with Elevated Privileges, refer to "Opening the Registry Editor with Elevated Privileges" blog article for instructions.
  2. Navigate to:

    HKCR\Drive\shell

  3. Create a new key by right-clicking "shell" to select New > Key. Name the new key RunAs.
  4. Double-click (default)located at:

    HKCR\Drive\shell\RunAs

  5. Enter the following in the Value Data filed:Elevated Command Prompt
  6. Create a new key by right-clicking "RunAs" to select New > Key. Name the new key command.
  7. Double-click (default)located at:

    HKCR\Drive\shell\RunAs\command

  8. Enter the following in the Value Data field:

    cmd.exe /s /k pushd "%V"

    [HKCR\Drive\shell\RunAs]
    Name: (default)
    Type: REG_SZ
    Data: Elevated Command Prompt

    [HKCR\Drive\shell\RunAs\command]
    Name: (default)
    Type: REG_SZ
    Data: cmd.exe /s /k pushd "%V"

To Add "Command Prompt Here" to a Folder or Drive Context Menu with Elevated Privileges – Using Reg Add

  1. Open a command prompt with Elevated Privileges, refer to "Opening an Elevated Command Prompt" blog article for instructions.
  2. Type the following in the elevated commands prompt window:
    • For Folders:

      reg add HKCR\Directory\shell\RunAs /ve /d "Elevated Command Prompt"

      reg add HKCR\Directory\shell\RunAs\command /ve /d "cmd.exe /s /k pushd \"%V\""

    • For Drives:

      reg add HKCR\Drive\shell\RunAs /ve /d "Elevated Command Prompt"

      reg add HKCR\Drive\shell\RunAs\command /ve /d "cmd.exe /s /k pushd \"%V\""

To Add "Command Prompt Here" to a Folder or Drive Context Menu with Elevated Privileges – Using a Registration File – Method 1

NOTE

To enlarge the images, simply click on the images you would like to view. With Internet Explorer 7, you can right-click on the image to select Open in New Tab.

  1. Download RunAs.Cmd.Here.reg to a folder on your hard drive.
  2. Open a command prompt with Elevated Privileges, refer to "Opening an Elevated Command Prompt" blog article for instructions.
  3. Change directories to the folder where you saved RunAs.Cmd.Here.reg. For example, if you saved the RunAs.Cmd.Here.reg file to "c:\users\Bill", then type the following in the elevated command prompt window:

    cd "c:\users\Bill"

  4. Then type the following in the elevated command prompt window to merge the registration file into the registry:

    RunAs.Cmd.Here.reg

  5. Click Yes to confirm you want to merge the RunAs.Cmd.Here.reg file into the registry.
  6. A confirmation window will appear asking if you want to merge the RunAs.Cmd.Here.reg registration file into the Windows Vista registry. Click Yes to continue with the merge of the registration file. Refer to Image below.

  7. If you are successful with merge of the RunAs.Cmd.Here.reg registration file then the following window should appear. Refer to Image below.

    NOTES

    The RunAs.Cmd.Here.reg file is from my company web server (http://lprf.homeserver.com).  You also can view the contents of the RunAs.Cmd.Here.reg file by right-clicking the file and selecting Edit. You may need to log off then log on to your user account or restart your computer for the changes to take affect.

To Add "Command Prompt Here" to a Folder or Drive Context Menu with Elevated Privileges – Using a Registration File – Method 2

NOTE

To enlarge the images, simply click on the images you would like to view. With Internet Explorer 7, you can right-click on the image to select Open in New Tab.

  1. Download RunAs.Cmd.Here.reg to a folder on your hard drive.
  2. If you have added "Run as Administrator" context menu for registration file using this article, "Adding "Run as Administrator" to a Registration File Context Menu" then right-click RunAs.Cmd.Here.reg to select Run as administrator.
  3. A UAC Prompt should appear to allow access to the elevated Registration merge. Click on Continue to allow the elevated Registration merge to continue. Refer to the Image below.

  4. A confirmation window will appear asking if you want to merge the RunAs.Cmd.Here.reg registration file into the Windows Vista registry. Click Yes to continue with the merge of the registration file. Refer to Image below.

  5. If you are successful with merge of the RunAs.Cmd.Here.reg registration file then the following window should appear. Refer to Image below.

    NOTES

    The RunAs.Cmd.Here.reg file is from my company web server (http://lprf.homeserver.com).  You also can view the contents of the RunAs.Cmd.Here.reg file by right-clicking the file and selecting Edit. You may need to log off then log on to your user account or restart your computer for the changes to take affect.

NOTE

To enlarge the images, simply click on the images you would like to view. With Internet Explorer 7, you can right-click on the image to select Open in New Tab.

Related Articles

Platforms Tested

  • Microsoft Windows Vista, x86 versions

Version 1.5
Edited: May 3, 2012

Advertisements

One Response to Adding an Elevated “Command Prompt Here” for Folders and Drives Context Menu

  1. Pingback: Opening an Elevated Command Prompt « BillJr's Space

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: