How to Add “Open PowerShell Here” to the Right-Click Menu for a Folder in Windows

apc_top

If you’re a fan of using Windows PowerShell rather than the Command Prompt, you might enjoy being able to access it right from the context menu you get when you right-click a folder in Windows. Here’s how to make it happen.

Windows already includes an “Open command window here” option when you Shift+click a folder. PowerShell offers a more powerful feature set, though, especially if you do any kind of automation through scripting. If you do prefer PowerShell, you either have to open PowerShell and then navigate to the folder or use the command from the menu in File Explorer. Instead, why not add an “Open PowerShell window here” option to the same context menu? It’s easy to do. You just have to dive into the Windows Registry for a couple of quick edits.

RELATED ARTICLES5 Cmdlets to Get You Started with PowerShellGeek School: Learn How to Automate Windows with PowerShell

Add “Open PowerShell Window Here” to the Context Menu by Editing the Registry Manually

To add an “Open PowerShell Window Here” option to the context menu, you just need to make a couple of quick edits in the Windows Registry.

Standard warning: Registry Editor is a powerful tool and misusing it can render your system unstable or even inoperable. This is a pretty simple hack and as long as you stick to the instructions, you shouldn’t have any problems. That said, if you’ve never worked with it before, consider reading about how to use the Registry Editor before you get started. And definitely back up the Registry (and your computer!) before making changes.

RELATED ARTICLESLearning to Use the Registry Editor Like a ProHow to Backup and Restore the Windows Registry

Open the Registry Editor by hitting Start and then typing “regedit.” Press Enter to open Registry Editor and give it permission to make changes to your PC.

own_1

In the Registry Editor, use the left sidebar to navigate to the following key:

HKEY_CLASSES_ROOTDirectoryshell

apc_2

Next, you’ll create a new key inside the shell key. Right-click the shell key and choose New Key. Name the new key “powershellmenu.” We’re naming our new key powershellmenu because in Windows 8 and 10 (and as you can see in our screenshot), a Powershell key already exists that serves other functions.

apc_3

Now, you’ll change the (Default) value inside the new powershellmenu key. With the powershellmenu key selected, double-click the (Default) value to open its properties window.

apc_4

In the properties window, set the value in the “Value data” box to “Open PowerShell Here” and then click “OK.” This gives the command the name that will appear on the context menu.

apc_5

Optionally, you can also set the command so that it only appears if you hold Shift down while right-clicking a drive—much the same way that the “Open Command Prompt” command is hidden unless you Shift+right-click a folder. To to that, right-click the powershellmenu key and choose New String Value. Name the new value “Extended.” You don’t need to make any changes to it. Just having that string there will cause the command to be hidden behind Shift key access.

apc_6

Whether you took the optional step of creating the Extended value or not, the rest of the process is the same. You’ll next need to create a new key inside your powershellmenu key. Right-click the powershellmenu key and choose New Key. Name the new key “command.”

apc_7

Now, you’ll change the  (Default) value inside the new command key. With the command key selected, double-click the (Default) value to open its properties window.

apc_8

The (Default) value specifies the actual command that will run when you select the option on the context menu. Type the following text into the “Value data” box and then click “OK.”

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

apc_9

The changes should take place immediately, so you can exit out of Registry Editor. To test it out, just right-click (or Shift+right-click if you set up that option) any folder and make choose the ”Open with PowerShell” command.

apc_a

The PowerShell window should open immediately and, after a few moments, place you inside the folder you right-clicked.

apc_10

If you want to reverse the changes at any time, just go back into the Registry and delete the powershellmenu key that you created. This will automatically delete any values and other keys you created inside the powershellmenu key and remove the command from your context menu.

Download Our One-Click Registry Hacks

apc_11

If you don’t feel like diving into the Registry yourself, we’ve created some registry hacks you can use. The “Add PowerShell to Context Menu” hack adds the PowerShell command to the regular context menu. The “Add PowerShell to Shift Context Menu” adds the PowerShell command to the context menu you get when you use Shift+right-click. And the “Remove PowerShell from Context Menu” removes the command no matter which way you added it. All three hacks are included in the following ZIP file. Double-click the one you want to use and click through the prompts.

PowerShell Context Menu Hacks

RELATED ARTICLEHow to Make Your Own Windows Registry Hacks

These hacks are really just the powershellmenu key, stripped down to the additional keys and values we talked about in the previous section and then exported to a .REG file. Running the hacks just modifies the value. And if you enjoy fiddling with the Registry, it’s worth taking the time to learn how to make your own Registry hacks.