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

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 Winkey.

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

; 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

; Opens the command shell 'cmd' in the directory browsed in Explorer.
; Note: expecting to be run when the active window is Explorer.
    ; 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%

    ; 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%"
        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

shareimprove this answer

Leave a Reply

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

You are commenting using your 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