Windows Explorer "Command Prompt Here"
WindowsCommand LineWindows ExplorerWindows Problem Overview
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?
Windows Solutions
Solution 1 - Windows
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 - Windows
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 - Windows
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 - Windows
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 - Windows
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:
2- After adding it you can access the folder from here:
That will open a command prompt in there for you.
Solution 6 - Windows
On vista and windows 7:
- Alt+d -> it will put focus on the address bar of the explorer window
- and then, type the name of any program you would launch using WIN+r
- hit Enter
The program will start with its current directory set to that of the explorer instance. e.g.:python, ghci, powershell, cmd, etc...
Solution 7 - Windows
For Windows vista and Windows 7 ,to open the command prompt
- go to folder you want to work
2)In address bar type- cmd
press enter
it will open the command prompt for that location
Solution 8 - Windows
You can edit the registry to add the Command Prompt item to the context menu. Here are a couple of .reg files that I use.
Cmdhere.reg - for WinNT/2000/XP/Vista/7:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\shell\OpenNew]
@="Command Prompt"
[HKEY_CLASSES_ROOT\Directory\shell\OpenNew\Command]
@="cmd.exe /k cd %1"
[HKEY_CLASSES_ROOT\Drive\shell\OpenNew]
@="Command Prompt"
[HKEY_CLASSES_ROOT\Drive\shell\OpenNew\Command]
@="cmd.exe /k cd %1"
Doshere.reg - for Win9x:
REGEDIT4
[HKEY_CLASSES_ROOT\Directory\shell\OpenNew]
@="MS-DOS Prompt"
[HKEY_CLASSES_ROOT\Directory\shell\OpenNew\Command]
@="command.com /k cd %1"
[HKEY_CLASSES_ROOT\Drive\shell\OpenNew]
@="MS-DOS Prompt"
[HKEY_CLASSES_ROOT\Drive\shell\OpenNew\Command]
@="command.com /k cd %1"
Copy this into an empty text file and change the extension to .reg. Double-clicking on this in Windows Explorer will add these key to the registry.
Solution 9 - Windows
I use StExBar, a Windows Explorer extension that gives you a command prompt button in explorer along with some other cool features (copy path, copy file name & more).
https://tools.stefankueng.com/StExBar.html
EDIT: I just found out (been using it for more than a year and did not know this) that Ctrl+M will do it with StExBar. How's that for fast!
Solution 10 - Windows
Almost the same as yours:
- Alt+d, Ctrl+c
- Win+r
- cmd /K cd , Ctrl+v, ENTER
Solution 11 - Windows
If that's so bothering, you could try to switch to windows explorer alternative like freecommander which has a toolbar button for that purpose.
Solution 12 - Windows
I use a lot the "Send To" functionality.
I create my own batch (.bat) files in the shell:sendto
folder and send files/folders to them using the context menu (to get there just write 'shell:sendto' in location bar).
I have scripts to perform all sort of things: send files by ftp, launch a php server in the current folder, create folders named with the current date, copy sent path to clipboard, etc.
Sorry, a bit offtopic but useful anyway.
Solution 13 - Windows
Tried the answer given by Tough Coder in Windows 7 and it works!
Create a shortcut to cmd.exe in %HOMEDRIVE%%HOMEPATH%\Links
, open its file properties and change the field 'Start at' to %1
('Iniciar en' translated from spanish).
Now drag folders to it and you'll see the magic. It works too in all standard Open File dialogs. wow!
ps: those 'strange' tabs above in my picture are because I use Clover. I recommend it!
Solution 14 - Windows
This solution also work for background menu: http://www.roggel.com/NGNeer/BackgroundCMD/
Solution 15 - Windows
http://www.petefreitag.com/item/146.cfm
-
Open up windows explorer
-
Tools -> Folder Options.
-
File Types Tab
-
Select the Folder file type
-
Click Advanced
-
Click New
-
For the Action type what ever you want the context menu to display, I used Command Prompt.
-
For the Application used to perform the action use c:\windows\system32\cmd.exe (note on win2k you will want to specify the winnt directory instead of the windows directory)
Solution 16 - Windows
Use the following in command prompt to open your current location in windows explorer:
C:\your-directory> explorer .