Start cmd from windows explorer

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)

  • AltD, CtrlC (copy path)
  • WinR, «cmd», Enter (start command prompt)
  • «cd», Space (start a change directory command)
  • AltSpace, e, p (paste directory)
  • Enter (execute change directory)

I know there is something better! What is it?

Hulk1991's user avatar

Hulk1991

3,08913 gold badges31 silver badges46 bronze badges

asked Dec 18, 2008 at 16:05

recursive's user avatar

recursiverecursive

84.1k34 gold badges151 silver badges241 bronze badges

5

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.

Palec's user avatar

Palec

12.8k8 gold badges69 silver badges138 bronze badges

answered Dec 19, 2008 at 0:28

clawr's user avatar

7

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

Palec's user avatar

Palec

12.8k8 gold badges69 silver badges138 bronze badges

answered Dec 19, 2008 at 15:13

dr. evil's user avatar

dr. evildr. evil

27k34 gold badges131 silver badges201 bronze badges

11

Inside your current folder, simply press Shift+Alt+Fthen—> 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

answered May 16, 2014 at 16:17

dimitrisk's user avatar

dimitriskdimitrisk

7749 silver badges15 bronze badges

3

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.

answered May 17, 2014 at 13:26

Bura Chuhadar's user avatar

Bura ChuhadarBura Chuhadar

3,6611 gold badge14 silver badges17 bronze badges

4

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…

answered Mar 5, 2013 at 23:36

Raymond Gauthier's user avatar

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

answered Jun 25, 2013 at 5:31

Shirish's user avatar

ShirishShirish

1531 silver badge2 bronze badges

2

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.

answered Sep 26, 2011 at 19:38

ctype.h's user avatar

ctype.hctype.h

1,4704 gold badges20 silver badges34 bronze badges

5

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!

Tom's user avatar

Tom

9649 silver badges25 bronze badges

answered Dec 18, 2008 at 16:11

palehorse's user avatar

palehorsepalehorse

26.5k4 gold badges40 silver badges48 bronze badges

Almost the same as yours:

  • Alt+d, Ctrl+c
  • Win+r
  • cmd /K cd , Ctrl+v, ENTER

answered Dec 18, 2008 at 16:18

Sam Meldrum's user avatar

Sam MeldrumSam Meldrum

13.8k6 gold badges34 silver badges40 bronze badges

2

If that’s so bothering, you could try to switch to windows explorer alternative like freecommander which has a toolbar button for that purpose.

answered Dec 18, 2008 at 16:12

Gennady Shumakher's user avatar

Gennady ShumakherGennady Shumakher

5,63712 gold badges40 silver badges45 bronze badges

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.

answered Aug 23, 2013 at 14:49

Ivan Ferrer Villa's user avatar

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!

enter image description here

Community's user avatar

answered Nov 26, 2014 at 3:09

Ivan Ferrer Villa's user avatar

Use the following in command prompt to open your current location in windows explorer:

C:\your-directory> explorer .

answered Jul 7, 2014 at 18:31

user2830432's user avatar

user2830432user2830432

2222 silver badges4 bronze badges

1

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)

  • AltD, CtrlC (copy path)
  • WinR, «cmd», Enter (start command prompt)
  • «cd», Space (start a change directory command)
  • AltSpace, e, p (paste directory)
  • Enter (execute change directory)

I know there is something better! What is it?

Hulk1991's user avatar

Hulk1991

3,08913 gold badges31 silver badges46 bronze badges

asked Dec 18, 2008 at 16:05

recursive's user avatar

recursiverecursive

84.1k34 gold badges151 silver badges241 bronze badges

5

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.

Palec's user avatar

Palec

12.8k8 gold badges69 silver badges138 bronze badges

answered Dec 19, 2008 at 0:28

clawr's user avatar

7

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

Palec's user avatar

Palec

12.8k8 gold badges69 silver badges138 bronze badges

answered Dec 19, 2008 at 15:13

dr. evil's user avatar

dr. evildr. evil

27k34 gold badges131 silver badges201 bronze badges

11

Inside your current folder, simply press Shift+Alt+Fthen—> 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

answered May 16, 2014 at 16:17

dimitrisk's user avatar

dimitriskdimitrisk

7749 silver badges15 bronze badges

3

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.

answered May 17, 2014 at 13:26

Bura Chuhadar's user avatar

Bura ChuhadarBura Chuhadar

3,6611 gold badge14 silver badges17 bronze badges

4

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…

answered Mar 5, 2013 at 23:36

Raymond Gauthier's user avatar

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

answered Jun 25, 2013 at 5:31

Shirish's user avatar

ShirishShirish

1531 silver badge2 bronze badges

2

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.

answered Sep 26, 2011 at 19:38

ctype.h's user avatar

ctype.hctype.h

1,4704 gold badges20 silver badges34 bronze badges

5

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!

Tom's user avatar

Tom

9649 silver badges25 bronze badges

answered Dec 18, 2008 at 16:11

palehorse's user avatar

palehorsepalehorse

26.5k4 gold badges40 silver badges48 bronze badges

Almost the same as yours:

  • Alt+d, Ctrl+c
  • Win+r
  • cmd /K cd , Ctrl+v, ENTER

answered Dec 18, 2008 at 16:18

Sam Meldrum's user avatar

Sam MeldrumSam Meldrum

13.8k6 gold badges34 silver badges40 bronze badges

2

If that’s so bothering, you could try to switch to windows explorer alternative like freecommander which has a toolbar button for that purpose.

answered Dec 18, 2008 at 16:12

Gennady Shumakher's user avatar

Gennady ShumakherGennady Shumakher

5,63712 gold badges40 silver badges45 bronze badges

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.

answered Aug 23, 2013 at 14:49

Ivan Ferrer Villa's user avatar

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!

enter image description here

Community's user avatar

answered Nov 26, 2014 at 3:09

Ivan Ferrer Villa's user avatar

Use the following in command prompt to open your current location in windows explorer:

C:\your-directory> explorer .

answered Jul 7, 2014 at 18:31

user2830432's user avatar

user2830432user2830432

2222 silver badges4 bronze badges

1

The Command Prompt is an incredibly useful way to perform certain tasks. For example, if you want to run a program with special parameters, the Command Prompt is one fast way to do it. The problem is that navigating the directory structure of a modern computer can be a real pain when using Command Prompt. Especially since Windows 10 supports such long folder and program names. 

The good news is that you can open Command Prompt directly from inside a Windows Explorer window. Taking you directly to that folder location! 

Command Prompt vs PowerShell

One important point about opening the command prompt in a folder, is that we’re referring specifically to the Windows Command Prompt, rather than PowerShell. Although both programs look similar, being a text-command interface, they are actually very different. 

Command Prompt is a simple, lightweight text interface for Windows. In contrast, PowerShell is a complex, powerful command line tool that lets power users do in-depth system management of the computer, among a long list of other handy abilities.

Command Prompt uses the “CMD.exe” while PowerShell uses “powershell.exe”, so they are entirely separate. Although some of the functionality overlaps, the two programs may use different commands to accomplish the same job. This article is only about the Command Prompt, but some of the shortcuts will also work for PowerShell. We’ll indicate when this is the case.

Open Command Prompt Using the Explorer Address Bar

When you open a Windows Explorer folder, you’ll see an address bar similar to that in a web browser. By default, it shows the path of the current folder. You can see it here.

If you click on this address bar, you can type in text. By typing “cmd” and hitting Enter, you’ll open up the command prompt at that location.

This will also work if you type “powershell” instead of “cmd”. Taking you directly to the Windows PowerShell prompt at that folder.

Adding “Open command window here”

In early versions of Windows 10, there was a context menu entry called “Open command window here” which would open the Command Prompt in the folder location you specify. For example, if you right-click on a folder and use this command, the Command Prompt starts at the current folder location.

After the 2017 Creator’s Update for Windows 10, Microsoft removed this option. Why? It’s most likely down to an effort from Microsoft to push people away from using the Command Prompt towards using PowerShell. 

Getting this command back is not very difficult, but it does require some tinkering in the Windows Registry. If you don’t feel comfortable doing that, it’s best to skip this method, but if you really want that context menu option back, here’s what to do.

First, click Start and type regedit. Then click on the regedit program entry.

With the registry editor open, look for the following registry key at this path:

HKEY_CLASSES_ROOT\Directory\shell\cmd

This is where things might start to feel a little risky, but we aren’t doing anything that will break your computer. But make sure you follow these exact instructions!

Right-click on the key and click Permissions in the context menu.

In the dialogue box that opens up, click Advanced.

At the top of the advanced settings window, you’ll see the listed owner of the key. Click the Change option.

Next, type your username and then click check names to validate it. Then click OK.

Finally, make sure the Replace owner on subcontainers and objects box is selected before clicking OK.

Now we’re back on the permissions page. Select Administrators under Group or user names and select Allow next to Full control. Then click OK.

Now we have to restore the context menu entry for the Command Prompt.

Back inside the CMD window, all we have to do is change the “DWORD” from “HideBasedOnVelocityiD” to “ShowBasedOnVelocityId”. Just right-click on it and choose rename, then change the name of the DWORD.

If all has gone as planned, you should now see the “Open command window here” option, when you SHIFT+right-click an item in the Windows Explorer window.

This next method of opening the Command Prompt from a Windows Explorer window involves navigating to where the Command Prompt program itself is stored and running it directly from there. This is still useful when, for one reason or another, other means of opening Command Prompt don’t work.

You can find “cmd.exe” in C:\Windows\System32. If you want to run it with administrative privileges, simply right-click cmd.exe and choose Run as administrator. There are plenty of commands that require administrative privileges to work and this is one of the ways you can start the Command Prompt with those privileges without leaving Explorer.

You’re In Command Now!

As they;ve done with HyperTerminal, Microsoft may choose to one day completely phase out Command Prompt, in favor of PowerShell. While that’s not a bad thing in itself, PowerShell could do with some polish to help non-power users who would have been fine with the Command Prompt to use common functions just as easily. Still, until the day Command Prompt actually does go the way of the Dodo, you can rest assured it’s only a few clicks away.

If you need to improve your Command Prompt skills, then why not check out these 21 commands that every Windows user should know. You’ll be flying through tasks in no time armed with these incredibly useful tricks.

Say I want to go to my documents folder and open a cmd session that starts in that folder. How might I do that? :)

gronostaj's user avatar

gronostaj

56.1k20 gold badges121 silver badges179 bronze badges

asked Jul 4, 2010 at 3:14

bobber205's user avatar

In Windows 7 and Vista, hold shift and right-click in/on a folder. You’ll get a new context menu option called «Open Command Window here».

There is an eponymous Windows XP PowerToy which adds exactly that feature to Windows XP.

answered Jul 4, 2010 at 3:31

Stephen Jennings's user avatar

Stephen JenningsStephen Jennings

23.2k5 gold badges72 silver badges107 bronze badges

1

The PowerToy will do it, but I prefer to use cmdopen, which can be found here.

answered Jul 4, 2010 at 3:42

Nathan's user avatar

NathanNathan

1763 bronze badges

Go to the Address Bar of the window and type in cmd and it’ll open a command prompt in the folder you’re currently in. No need to install anything.

answered Feb 4, 2013 at 14:55

Corey Ogburn's user avatar

Corey OgburnCorey Ogburn

6862 gold badges12 silver badges29 bronze badges

4

You must log in to answer this question.

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

.

I know that you can start cmd or powershell from windows explorer; when you type «cmd» or «powershell» in current path of the explorer window. But what when you have folders that are named «CMD» or «powershell». I have them both and when I type their names respectively instead of starting them explorer goes in those folders.

Any solutions for this, so I can still type and start those shell from windows explorer from parent folder(i.e. folder that contains «cmd» and «powershell» folders). Thanks xD.

asked Jun 21, 2017 at 19:16

IGRACH's user avatar

If you have a subfolder named «cmd» you could type in %COMSPEC% instead, and it opens CMD (because it’s an environment variable that holds the direct path to cmd.exe, unless you’ve changed your COMSPEC from the default).

Instead, my suggestion would be to make a couple batch files, with short unique names, to load CMD and/or Powershell. Put them in your path, and then use the batch file names in the address bar instead.

answered Jun 21, 2017 at 20:07

techie007's user avatar

techie007techie007

1,89417 silver badges25 bronze badges

1

This solution involves using the mouse: if you have the folder open in Windows Explorer, and no other files or folders are selected, you can hold Shift + right-click and select Open command window here

(This only works for COMSPEC in Windows 7 and higher.)

answered Jun 26, 2017 at 18:29

JonathanDavidArndt's user avatar

You must log in to answer this question.

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

.

  • Start is back windows 10 скачать крякнутый
  • Starcraft для windows 10 скачать
  • Start torrent when windows starts up перевод
  • Ssl self signed certificate windows
  • Start exe as service windows