Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I open a command prompt in current folder with a keyboard shortcut in Windows 7?
Is there any way to implement this?
I think Autohotkey could do this, but don't know how.

share|improve this question
Related: Open command prompt window without holding shift – slhck Feb 25 '13 at 10:19
Protip: Shift right-click > Open Command Window Here – Derek 朕會功夫 Jul 2 '15 at 3:10
up vote 88 down vote accepted

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

; 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

share|improve this answer
ah, shift-menu is nice. – akira Oct 31 '10 at 11:50
How do you use this script exactly? – Jonathan Feb 1 '11 at 7:12
@Jonathan: Install Auto-HotKey ( Copy the script contents to the AutoHotkey.ahk file. (probably in %USERPROFILE%\documents\) Restart Auto-Hotkey. – Leftium Feb 1 '11 at 8:17
This was the only working solution out of all the AutoHotkey snippets I found on the web. Thanks a lot! – Lucas Oct 23 '14 at 10:35
Does not work for me. – boleslaw.smialy Jul 29 '15 at 12:20

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

share|improve this answer
nice! the other option doesn't seem to show the "open command window here" option unless you right-click on a folder - inside the folder, it doesn't show – divillysausages Feb 26 '13 at 21:55
This opens a cmd window, but it does not open one at the current directory. The same thing can be accomplished with win+r, cmd – Ed Orsi Jul 2 '14 at 19:02
Note - You do not need to press Alt+d for this to work. All I had to do in Windows 7 was type cmd into the path of windows explorer and press enter. Alt+d just automatically selects the current path. – MiniRagnarok Jul 30 '15 at 12:50
Ctrl+L is an alternative. – pkr298 Sep 29 '15 at 14:56

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.

share|improve this answer
Thanks! I knew the first way, even it is simple enough, i still like the way of using keyboard shortcuts. And the second way seems a little complicated – Gemili Oct 31 '10 at 6:50
Love it, +1 10 char min – jcollum Apr 7 '11 at 15:34

AutoHotKey script to open command prompt using @Ashwin's method

Open Powershell console using Win P

    Send !D
    Send powershell
    Send {Enter}    

Open command prompt using Win C

    Send !D
    Send CMD
    Send {Enter}    
share|improve this answer

If you are using a german languaged Windows version you can do this:

Press Alt+D,E

Alt+D opens a menu where you can select a few other things besides the cmd

share|improve this answer
Alt+D select the Address Bar, not a menu – Canadian Luke Jul 29 '15 at 18:03
Seems to only work on German languaged Windows versions – foobarbaz Jul 29 '15 at 22:55
Edit your answer then I can remove the down vote – Canadian Luke Jul 29 '15 at 22:58

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.