Open Command Prompt Here

One can extend the context menu when right-clicking a folder in Windows Explorer, with the option to open a command prompt in that directory. Instead of just opening the command prompt and manually changing to the wanted directory.
Manual add option using Windows Explorer
To manually add the option through Windows Explorer interface:
  1. Start "My Computer"
  2. In the "My Computer" menu select "Tools" -> "Folder Options..."
  3. Select the fan "File Types"
  4. Sort the registered file types by name by clicking the 2nd column
  5. Find and select the file type "Folder"
  6. Press the "Advanced" button, and a new window pops up
  7. Press the "New..." button, and a new window pops up
  8. Set the action to be :

    Open Command Prompt Here

  9. Set the application to be :

    cmd.exe /k "cd %L"

    Note that the "%L" is used to show the long name of the directory. If you use "%1" then it will use the 8.3 format.
  10. Press Ok to save the newly added entry
Related Configure file types to include your own useful actions
Manual add option using Registry Editor
Note one can also extend the context menu by applying the following registry settings. More Info MS KB320148:

REGEDIT4

[HKEY_CLASSES_ROOT\Directory\shell\cmd]
@="Open Command Window Here"

[HKEY_CLASSES_ROOT\Directory\shell\cmd\command]
@="cmd.exe /k \"cd %L\""

[HKEY_CLASSES_ROOT\Drive\shell\cmd]
@="Open Command Window Here"

[HKEY_CLASSES_ROOT\Drive\shell\cmd\command]
@="cmd.exe /k \"cd %L\""

Note if not running as administrator by default, and want to open a command prompt session with administrator rights, then it can be done by adding a RunAs option for the directory filetype (Useful if using Windows Vista):

REGEDIT4

[HKEY_CLASSES_ROOT\Directory\shell\runas]
@="Open Command Window Here (Administrator)"

[HKEY_CLASSES_ROOT\Directory\shell\runas\command]
@="cmd.exe /k \"cd %L\""

[HKEY_CLASSES_ROOT\Drive\shell\runas]
@="Open Command Window Here (Administrator)"

[HKEY_CLASSES_ROOT\Drive\shell\runas\command]
@="cmd.exe /k \"cd %L\""

Updated: 2 December 2009

Comments:

  1. Ravi says:

    I love it!! just installed it on my Win 2k3 VM image.

Leave a Reply

Your email address will not be published. Required fields are marked *