How can I open a command prompt in current folder with a keyboard shortcut?

Press Alt+D, type cmd and press Enter. For more details see blog post here.


Use this keyboard shortcut: Shift + Menu, W, Enter

  1. Shift + Menu (alternatively, Shift + F10), (opens extended right-click menu in current folder)

  2. W (selects "Open Command Window Here"),

  3. Enter (activates selection; required since "New" is also selectable with W)

The Menu key refers to the special key introduced by Microsoft, usually to the right of the right Win key.

This shortcut is available on a default installation of Windows (7) without any 3rd party software.


The AHK way. You just need to press Win + C (or whatever you want to define it as.):

SetTitleMatchMode RegEx
return

; Stuff to do when Windows Explorer is open
;
#IfWinActive ahk_class ExploreWClass|CabinetWClass

    ; create new text file
    ;
    #t::Send !fwt

    ; open 'cmd' in the current directory
    ;
    #c::
        OpenCmdInCurrent()
    return
#IfWinActive


; Opens the command shell 'cmd' in the directory browsed in Explorer.
; Note: expecting to be run when the active window is Explorer.
;
OpenCmdInCurrent()
{
    ; This is required to get the full path of the file from the address bar
    WinGetText, full_path, A

    ; Split on newline (`n)
    StringSplit, word_array, full_path, `n

    ; Find and take the element from the array that contains address
    Loop, %word_array0%
    {
        IfInString, word_array%A_Index%, Address
        {
            full_path := word_array%A_Index%
            break
        }
    }  

    ; strip to bare address
    full_path := RegExReplace(full_path, "^Address: ", "")

    ; Just in case - remove all carriage returns (`r)
    StringReplace, full_path, full_path, `r, , all


    IfInString full_path, \
    {
        Run,  cmd /K cd /D "%full_path%"
    }
    else
    {
        Run, cmd /K cd /D "C:\ "
    }
}

As a bonus, the script above also creates a new text file with this shortcut: Win + T

Credit to: Eli Bendersky


the native way to do something similar in windows7 is to hold down shift while pressing the right mouse onto the folder you want to "command prompt" to and a new menu item will appear in your context menu offering you exactly that: "open command prompt here".

alt text

if you want pure keyboard action then you have to do this:

  • open regedit
  • go to HKEY_CLASSES_ROOT\Directory\shell\cmd and rename the Extended key to Extended_save
  • go to HKEY_CLASSES_ROOT\Drive\shell\cmd and rename the Extended key toExtended_save`

this adds the "open command window here" entry to the context menu permanently. you can trigger this entry by pressing:

  • alt
  • let go, context menu opens
  • press the "underscored" character of the "open command window here" entry or go down with your cursor keys and hit enter

the name of the menu entry is labled according to the language of your OS.

an alternative route is to do this:

  • open the folder you want in the command prompt via the explorer
  • f4
  • ctrla
  • ctrlc
  • winr
  • cmd /k cd ctrlventer

which grabs the current path from the address bar of explorer and executes cmd /k cd PATH. with autohotkeys you can do the same, but i do not know autohotkeys.