Terms of Use For FixedByVonnie

By proceeding to access fixedByVonnie.com, you expressly acknowledge, and agree to, all of the following:

fixedByVonnie.com is a personal website and blog owned by Security Plus Pro LLC, which is being presented for informational purposes only. The views on this website are solely those of the website owner (and not those of any employer or of any professional associations affiliated with the website owner).  Any views expressed in this website and any information presented on this website, or in any of its blog entries, should not be relied on for any purpose whatsoever other than as the personal opinions of the website owner.  The website owner expressly disclaims any and all liability for any information presented on this site.  The owner of this website and its blog posts shall not be held liable, and shall be held harmless, for any errors or omissions in any information or representations contained in this website, or in any of its blog entries.  The website owner also expressly disclaims any liability for the current or future availability of any such information. The website owner makes no representations as to the accuracy or completeness of any information on this website or which may be found by following any link on this website. The website owner shall not be held liable for any losses, injuries, damages, claims, or causes of action, from the display or use of any information on this website or in any of its blog entries. If you use the information on this website, or on any of its blog entries, you do so solely at your own risk.

How to add a "Open PowerShell Here" command to the context menu in Windows 8 - fixedByVonnie

How to add a “Open PowerShell Here” command to the context menu in Windows 8

If you right click a folder while holding down the shift key you’ll see a little command buried in the context menu called “Open command prompt here”.

This provides convenient access to the command prompt and drops you in the directory you right-clicked.

But today I need to challenge the status quo – why should the command prompt get all the glory?  I mean seriously: why isn’t there an Open PowerShell here command?

Today I’m going to show you how to hackup the registry so we can make your Powershell dreams comes true.

We’re going to be fiddling with the registry so we need to make sure that we back it up before we do anything.

Press the Windows Key + r and paste in the following command to the run box:

regedit

Windows 8.1 Regedit

After backing up the registry, we need to create a new sub-key that will provide the text in our context menu and the path to launching Powershell.


 

In the left pane, click through the folder maze until you find this:

Computer\HKEY_CLASSES_ROOT\Directory

Right-click the sub-key called shell and mouse over to New and pick Key.

New shell sub-key

Go ahead and name the key:

powershell

In the right pane double click (Default) and set the value to:

Open PowerShell here

Creating Open PowerShell here context menu

Now that we have the right-click “text” in place we just need to create the command to run when we click “Open PowerShell here”

Right-click the empty space in the right-pane and choose New and click on Key.

You should see a new key called command magically materialize below the powershell key in the left pane.

We just need to paste in the PowerShell path as the (Default) value for the command key.


My version of PowerShell is located here:

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe

But I can’t just paste it in like this because we need to explicitly escape the backslashes in the path and add a few extras so that the command windows doesn’t automatically close after opening.

Here’s the whole shebang:

C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\powershell.exe -NoExit -Command Set-Location -LiteralPath '%L'

You can see that I’m escaping each backslash with a backslash.  Also, the -NoExit option forces the PowerShell window to stay open.  And the Set-Location cmdlet with the LiteralPath switch tells us to open the window using the path of the current window.

That’s all there is to it.

The real beauty of this trick is that:

  • You don’t need to reboot after making the change
  • You don’t have to hold down the Shift key to make the option appear

You can now immediately right-click any folder and choose Open PowerShell here and zoom right to the shell.

Open PowerShell here hack

And there you have it!

How’s that for a hack?

PowerShell window

If this helped you please share the joy in the comments!

About

Connect with Vonnie on Twitter

Posted in Windows, Windows 8, Windows 8.1 Tagged with: ,
  • In Windows 10, I had to go back and rename the subkey that was automatically created by this step: “You should see a new key called command magically materialize below the powershell key in the left pane.” I got “new key #1”. But after that this does work with Windows 10! Though I have always wondered how to get an icon in the context menu… as DropBox has in your screenshot.