84

When I'm working in a folder in Windows Explorer, sometimes I have a need to run some CMD command in this folder.

How do I open the command line from a current folder, so the console opens in the current directory?

Example:

I work in D:\Apps\Test. I would like to have a possibility to open a command prompt with the same context (meaning: D:\Apps\Test), so I don't have to navigate to this folder again within a console, ie. so it opens cd'd to the current location.

EDIT: The solutions from this topic do not work for me, what's why I asked a separate question.

7
  • @Dave : the solutions from this topic do not work on my station. Jul 29, 2015 at 12:24
  • @Dave : ok, I got it. I will adjust next time. Jul 29, 2015 at 12:33
  • 1
    Note that all answers to both this question and the linked question may not work as expected if the folder is a special system folder. For example, if you are in Libraries > Documents, the shift-right-click menu won't even offer the command prompt option, and the explorer bar option will open the cmd window to C:\Windows\system32 (it does work fine from C:\Users\User_name\Documents, though) Jul 29, 2015 at 17:49
  • Shift-right click would let you open cmd in current directory. Jul 30, 2015 at 2:14
  • 1
    Why isn't this question closed as duplicate? "The solutions did not work for me" is not a good reason. The most voted answer here is a variant of this answer.
    – Salman A
    Jul 31, 2015 at 8:44

9 Answers 9

133

You can also shift-right-click in a folder, and notice a new entry in the context menu (Open command window here):

http://i.imgur.com/nbfURik.png

17
  • 9
    Not sure why anyone would use the 'cmd' option over this.
    – Mdev
    Jul 29, 2015 at 16:59
  • 3
    cmd in explorer bar gives you address to the current folder. Shift right-click gives you command prompt access to a subfolder. They have different use cases so I don't see a conflict here.
    – Sun
    Jul 29, 2015 at 18:33
  • 11
    @sunk818 You can get the current folder also if you right click not on a folder.
    – Seiyria
    Jul 29, 2015 at 18:54
  • 8
    @Matthew Press Alt+D, C, M, D, Enter. Very efficient. Your hands never leave the keys. (You can do Shift+Menu and then arrow down after arrowing to select the folder your want, but it's much less convenient.)
    – jpmc26
    Jul 30, 2015 at 0:27
  • 1
    @boleslaw.smialy Do you have an inkling as to why it doesn't work for you? It works for me and I'm using Windows 7. Is there anything special you haven't mentioned? Jul 30, 2015 at 12:54
231

Enter cmd in explorer's address bar & press enter

enter image description here

11
  • 33
    OMG, I can't believe that actually works! +1 for both answers. :)
    – LPChip
    Jul 29, 2015 at 12:22
  • 4
    Even better is that it works for other programs too!
    – afrazier
    Jul 29, 2015 at 17:31
  • 1
    thanks for pointing that out afrazier, just tried with powershell and it worked great. (You would need to play around with registries to add a powershell entry to your context menu).
    – Xantix
    Jul 29, 2015 at 23:37
  • 11
    also, for efficiency, ALT+D ,"cmd" , ENTER
    – Some_Guy
    Jul 30, 2015 at 12:54
  • 3
    That's because you can't cd to a network drive unless it is mapped to a drive letter
    – Borodin
    Jul 30, 2015 at 18:24
40

How do I open Windows CMD in explorer from the current folder?

Enter cmd in the explorer address bar and press Enter

enter image description here

5
  • 1
    followup question: is it also possible to open the cmd as administrator? entering cmd then CTRL-SHIFT-ENTER doesn't seem to work.
    – LPChip
    Jul 29, 2015 at 12:24
  • 1
    @LPChip I don't think so. It opens command as the current user ... :/
    – DavidPostill
    Jul 29, 2015 at 12:36
  • 2
  • 2
    @DavidPostill, How about enabling "run this program as an administrator" for c:\windows\system32\cmd.exe ? I could confirm it but I don't want to try this on my work computer right now :D
    – clhy
    Jul 29, 2015 at 12:52
  • @The_IT_Guy_You_Don't_Like - I can't test it either. I don't have a non admin account here.
    – DavidPostill
    Jul 29, 2015 at 12:53
17

Hold down shift while right-clicking anywhere in the folder. You will be presented with an option to "Open Command Window Here".

You can also shift + right click on any sub folder and open a command window there as well.

12

If you're a GUI kind of person, holding Shift during right-click makes "Open command window here" appear in the context menu. You can try it on current or nested folders.

0
10

I use the ContextConsole Shell Extension. When you make a right click you get an option to run a command prompt and run a command prompt as admin (elevated) to do system tasks.

enter image description here

4
  • It is interesting solution, but for most corporate people it would be useless because of lack of Adm privilages. Jul 30, 2015 at 10:19
  • yes, but I have the permissions and use it very often to runs scripts that require elevation. Here this extension is used very often. Jul 30, 2015 at 15:57
  • Will this work with right clicking on empty space too (e.g. Desktop) or only when clicking on folder items in Explorer?
    – Samir
    Jul 30, 2015 at 23:20
  • @sammyg this will work only for clicking on en empty entry. Jul 31, 2015 at 4:19
4

If you don't mind using third-party extensions, the free ClassicShell allows adding a custom toolbar to Windows Explorer.

Example of custom toolbar

The image shows the configuration that I currently use. The button on the far right opens a console window to the current folder. This is how you can get it.

  • Install the Classic Explorer part of ClassicShell
  • Open a new Explorer window. You should now see an additional toolbar right below the address bar.
  • Right-Click into the toolbar and select 'Classic Explorer Settings'
  • In the opening dialog window, check the 'Show all settings' checkbox.
  • Go to the 'Toolbar Buttons' tab to configure the layout of the custom toolbar. Feel free to throw out any buttons that you don't like.
  • Add a 'Custom' button from the list on the right. Double-click the newly added button in the list on the left and enter cmd in the 'Command' field.

I am usually not a big fan of third-party extensions, but I found this one to be very useful, especially for this particular use case.

3

While at the explorer, in the bar at the top there is a file menu where you have the option to open the command window for the current directory. This work in Windows 8. (In Windows 7 hold down the shift key when you click the File menu).

1
  • Yes, that works for windows 8 and 8.1, but the O.P. asked specifically for windows 7. Jul 31, 2015 at 9:34
0

Note that - if you want a static icon on the desktop that opens the CMD prompt at a certain folder location - you can also do the following:

  1. Create a shortcut on the desktop to CMD.EXE
  2. Right-click the shortcut and go into Properties
  3. On the Shortcut tab, put your desired location in the "Start In" field.

Obviously, this only works from the icon and always opens the same location. The other answers are a better way of opening the prompt to whatever your current folder is (dynamically).

Not the answer you're looking for? Browse other questions tagged .