Windows File Explorer Cmd Trick

I’m going to start my first real blog post with 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!

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.

A New ‘Command Prompt’ Window - 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?

A New ‘Command Prompt’ Window - 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.

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’ Window - The Easy Way

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