Windows Explorer "Command Prompt Here"

153,395

Solution 1

Hold Shift while Right-Clicking a blank space in the desired folder to bring up a more verbose context menu. One of the options is Open Command Window Here. This works in Windows Vista, 7, 8, and 10. Since Windows 10 Creators Update, the option has been replaced with Open PowerShell Here. However, there are ways to enable Open Command Window Here again.

Solution 2

Just type "cmd" to location bar, that's it. It will start a new command prompt in current path.

This solution was confirmed to work in Windows XP, Vista, 7, 8 and 10 (including Creators Update).

Keystrokes to move the focus to the location bar:

  • AltD in English (pointed out by Tim Stewart in the comments)
  • AltE in German

Solution 3

Inside your current folder, simply press Shift+Alt+F --then--> Enter.

The prompt will appear with your current folder's path set.

Note: That works only in Windows 7 / Vista. What it does is that drops the "File" menu down for you, because the "Shift" key is pressed the option "Open command window here" is enabled and focused as the first available option of "File" menu. Pressing enter starts the focused option therefor the command window.

Edit:

In case you are in a folder and you already selected some of its contents (file/folder) this wont work. In that case Click on the empty area inside the folder to deselect any previously selected files and repeat.

Edit2:

Another way you can open terminal in current directory is to type cmd on file browser navigation bar where the path of current folder is written.

In order to focus with your keyboard on the navigation bar Ctrl+L. Then you can type cmd and hit Enter

Solution 4

Right-click the title-bar icon of the Explorer window. You'll get the current folder's context menu, where you'll find the "command window here" item.

(Note that to see that menu item, you need to have the corresponding "power toy" installed, or you can create the right registry keys yourself to add that item to folders' context menus.)

Solution 5

As a very quick solution I can give you this. I tested this on Windows 8.1

1- Find File and Right Click on Command Prompt on File Explorer and then add command prompt to your Quick Access Toolbar:

Instruction 1

2- After adding it you can access the folder from here:

Instruction 2

That will open a command prompt in there for you.

Share:
153,395

Related videos on Youtube

B Bulfin
Author by

B Bulfin

I like bikes. For more information, see here.

Updated on August 05, 2020

Comments

  • B Bulfin
    B Bulfin almost 4 years

    I frequently find myself with a folder open in Windows, wishing to have a command prompt open with the same working directory.

    I am aware of Power Toys "Command Prompt", but that only works as a context menu item on the folder, and not from inside the folder if you are already there. I know you can navigate to the parent directory, and use it from there, but if the parent has thousands of directories in it, this is not so convenient. I have tried some home-brewed batch files associated with folder actions in explorer, but those suffer from similar problems.

    So, what is the quickest way to open a command prompt with a working directory of the current windows explorer folder?

    My current approach: (horrible)

    • Alt - D, Ctrl - C (copy path)
    • Win - R, "cmd", Enter (start command prompt)
    • "cd", Space (start a change directory command)
    • Alt - Space, e, p (paste directory)
    • Enter (execute change directory)

    I know there is something better! What is it?

    • B Bulfin
      B Bulfin over 15 years
      It's not specifically about a programming language, but the only reason I ever need to do this is because of something programming related, and I am sure others have encountered it as well.
    • Gennady Shumakher
      Gennady Shumakher over 15 years
      @Daok I think you are too strict.Just look for questions tagged with 'command-line':'What is the safest way to empty a directory in *nix?','How can I diff two files with full context?',etc. Many programmers use cmd line which affects their productivity. I think it's valid question not related to IT.
    • EBGreen
      EBGreen over 15 years
      Well for what it is worth, I feel that it really is an OS question. It is true that the OS definitely does effect programming, but everything in the programmer's life does and you have to draw the line somewhere.
    • Lawrence Dol
      Lawrence Dol over 15 years
      @Daok: Get off your high horse! Programmers often need tips about how to do their jobs faster; quickly getting to a command line is one of them. You need you moderator privileges revoked, IMHO.
    • Lawrence Dol
      Lawrence Dol over 15 years
      @recursive: Google for this; I found a small registry change for Windows XP that worked for any file in the folder, I think... but it was a long time ago, and I wanted to click the folder so I didn't pursue it.
  • B Bulfin
    B Bulfin over 15 years
    Excellent! The last line seems like it should be "cmd /K cd /D", Ctrl+v, ENTER For posterity.
  • EBGreen
    EBGreen over 15 years
    You may need "s if there are spaces in the path.
  • Hugh Allen
    Hugh Allen about 15 years
    Cool. Is there a way to do that with the keyboard?
  • Rob Kennedy
    Rob Kennedy about 15 years
    Hugh, please see fm's answer: type "cmd" into the address bar. Based on the question's text, I gather you can get to the address bar with the keyboard with Alt+D.
  • Kounavi
    Kounavi over 11 years
    Used this and works perfectly :). But, how can I have a similar option with elevated privileges (will prompt for UAC naturally)?
  • drzaus
    drzaus almost 11 years
    All I needed to do was add a reg for HKEY_CLASSES_ROOT\Folder\shell, rather than Directory and Drive
  • Laurence
    Laurence over 10 years
    This trick also works with PowerShell for Windows 7/8/Server 2008+. Typing powershell in the command bar will bring up a powershell window set to that directory.
  • phuclv
    phuclv over 10 years
    This works from vista above. You can also shift+click on some folder itself
  • mgr326639
    mgr326639 about 10 years
    I love this mouseless approach. The only thing is that is will not work from a UNC location (\\server\sharename). Then you'll need to use shift right-click, Open command window here. A network drive will be created on the fly.
  • B Bulfin
    B Bulfin about 10 years
    In Windows Explorer on Windows 7, that merely drops the file drop down menu for me.
  • Naypa
    Naypa almost 10 years
    It also works in Windows XP, the difference is that you must click on the folder icon itself.
  • FractalSpace
    FractalSpace almost 10 years
    Works for me (Windows 7 Professional)
  • Steve Vermeulen
    Steve Vermeulen over 9 years
    And if you're too lazy to even do this, you can use this autohotkey script to map it to CTRL+T: #IfWinActive ahk_class CabinetWClass ^T:: Send !dcmd{Return} return #endif
  • Ivan Ferrer Villa
    Ivan Ferrer Villa over 9 years
    well thought out! People using W7 see my answer below.
  • Admin
    Admin about 9 years
    Alt+D/E doesn't work on a french laptop with Windows 7 :-(
  • Admin
    Admin about 9 years
    Full keyboard solution (Windows 7): SHIFT+F10 to open the context menu, then press the letter associated to the command prompt ("f" in french). Cocorico :-)
  • matt wilkie
    matt wilkie almost 9 years
    off topic, the Q is about the other direction, opening CMD from Explorer.
  • Allen
    Allen almost 9 years
    It doesn't work on my Win 10, %1 param should be embraced with quotes like this: command.com /k cd "%1" And for Drive it doesn't work because cd command could not change current drive.
  • ctype.h
    ctype.h over 8 years
    This also works on Windows 10.
  • serge
    serge over 8 years
    how about cmd as Administrator?
  • RoG
    RoG almost 8 years
    The real gem here is that holding shift while accessing the File menu shows this command. Easier to remember than the key combo and I'm betting it works on Windows 10 too.
  • phuclv
    phuclv over 7 years
    @procrastinator F10 is to open the main menu. The context menu is opened by the menu key (the key between right Alt and right Ctrl), so you can use Shift+Menu
  • Admin
    Admin over 7 years
    @LưuVĩnhPhúc I don't have the "menu" key on my laptop :-|
  • James Yeoman
    James Yeoman over 7 years
    Doesn't work for Win 8.1 as Windows Explorer doesn't have that option.
  • elsadek
    elsadek over 7 years
    @JamesYeoman which option ?
  • James Yeoman
    James Yeoman over 7 years
    Tools. I have heard about this context menu hack a while ago but I haven't been able to do it because there isn't a Tools menu
  • James Yeoman
    James Yeoman over 7 years
    This is useful for most cases but I sometimes just drag folders and files to the desktop when working with a small amount of stuff. It just means that I don't need to make a new directory to put things from multiple directories into one place. Would be awesome if there was a solution for the desktop.
  • user5389726598465
    user5389726598465 about 7 years
    this answer was given already five years before you. Why do people post identical answers over and over?
  • antikbd
    antikbd about 7 years
    this is just as good as the right-click method, which weirdly brings up only the PowerShell option for me (Win10 Pro).
  • Dave45
    Dave45 almost 7 years
    @antikd - the r-click method ceased to offer the command prompt with the Creators Update (April/May 2017) to Win10, leaving just the Powershell option... why?
  • erikvimz
    erikvimz almost 7 years
    Btw, dr. evil's answer still works with latest Windows 10. Just type cmd in location bar.
  • Brad Christie
    Brad Christie almost 7 years
    Those loking to get it back thnx to Win10CU,take ownership of and rename HKEY_CLASSES_ROOT\Directory\shell\cmd,HideBasedOnVelocityId key (add an underscore prefix or something) and command prompt option returns! (ref)
  • Lupilum
    Lupilum almost 7 years
    @Dave45 Microsoft wants to promote PowerShell.
  • user5670895
    user5670895 over 6 years
    This was removed in the Windows 10 Creators Update. Powershell still remains though.
  • amuliar
    amuliar over 6 years
    In Windows 10 use File -> Open Windows PowerShell. For help on command use (for example): Get-Help mkdir
  • Gaurav Chauhan
    Gaurav Chauhan about 6 years
    @Shirish thanks for the tip. your answer helped to save lot of time. worked in win10.
  • MicrosoftShouldBeKickedInNuts
    MicrosoftShouldBeKickedInNuts almost 5 years
    Yes on Win 7; but no, absolutely not on XP as just tested. It opens a browser and goes to cmd then cmd.com . And no, I did not go control enter; just enter. And BTW you forgot to say to hit ENTER :) (or click to process it, generally a right-arrow icon)
  • Dark Matter
    Dark Matter over 3 years
    Hey @leaf, can you try Ctrl + L? It is an alternative to move the focus to the location bar.
  • Admin
    Admin over 3 years
    @DarkMatter It works thanks :-) But I upgraded to Windows 10 long ago :-|
  • Thomas Weller
    Thomas Weller over 2 years
    cmd /k cd "%v\." worked for me in Computer\HKEY_CLASSES_ROOT\Directory\Background\shell\cmd here\command