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)
I know there is something better! What is it?
This question is related to
windows
command-line
windows-explorer
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.
Almost the same as yours:
If that's so bothering, you could try to switch to windows explorer alternative like freecommander which has a toolbar button for that purpose.
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!
Almost the same as yours:
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!
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:
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.
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)
If that's so bothering, you could try to switch to windows explorer alternative like freecommander which has a toolbar button for that purpose.
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.)
On vista and windows 7:
The program will start with its current directory set to that of the explorer instance. e.g.:python, ghci, powershell, cmd, etc...
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:
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.
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.)
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:
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.
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
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!
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.
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)
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:
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!
Use the following in command prompt to open your current location in windows explorer:
C:\your-directory> explorer .
If that's so bothering, you could try to switch to windows explorer alternative like freecommander which has a toolbar button for that purpose.
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.
On vista and windows 7:
The program will start with its current directory set to that of the explorer instance. e.g.:python, ghci, powershell, cmd, etc...
For Windows vista and Windows 7 ,to open the command prompt 1) go to folder you want to work
2)In address bar type- cmd
press enter
it will open the command prompt for that location
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.)
Almost the same as yours:
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!
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.)
If that's so bothering, you could try to switch to windows explorer alternative like freecommander which has a toolbar button for that purpose.
For Windows vista and Windows 7 ,to open the command prompt 1) go to folder you want to work
2)In address bar type- cmd
press enter
it will open the command prompt for that location
Almost the same as yours:
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.
This solution also work for background menu: http://www.roggel.com/NGNeer/BackgroundCMD/
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.
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.
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
This solution also work for background menu: http://www.roggel.com/NGNeer/BackgroundCMD/
Use the following in command prompt to open your current location in windows explorer:
C:\your-directory> explorer .
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.
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!
Source: Stackoverflow.com