How to Open a Command Prompt From File Explorer

Here’s a neat little trick that I stumbled across the other day in a Coding4Fun blog post by Greg Duncan, called A Simple File Explorer Magic Trick.

Well, it certainly blew my mind Greg!

I’ve been working with Windows for quite sometime (since 3.11) and I didn’t know you could do that (though who know which version it was introduced in).

Scenario

Say you’re working with some files in a File Explorer window, but you now need to open a Command Prompt that points to that same folder. Maybe you need to issue a few git commands, or node commands.

New Command Prompt

The Hard Way

You could:

  • copy the path from the address bar
  • open a Command Prompt manually
  • paste the path into a cd command
  • press ENTER

Copy Path From Address Bar
Paste Path Into Cd Command

Or, what would you say if I tell you that you can do it right in the file explorer window where you’re already working, without going through all of those steps?

The Easy Way

It’s so simple:

  • click in the file explorer’s address bar (or press Atl-D)
  • type cmd
  • press ENTER

New Command Prompt The Easy Way

A new Command Prompt window opens with the path set to the current folder, without you having to copy and paste it there!

I’ve found this technique to be very handy for working with Gulp or Node.

New Powershell Prompt

The same technique also works for PowerShell:

  • type powershell in the address bar
  • press ENTER

New Powershell Prompt The Easy Way

A new PowerShell window opens with the path set to the current folder.

New File Explorer

A similar technique works in reverse too!

At a command prompt:

  • type start .
  • press ENTER

A File Explorer window opens with the path set to the current folder.

Instead of the dot you can put any valid folder path, including environment variables like %appdata% etc.

More Info

If you’d like more info about what else you can do, have a look at these articles:

Share Comments