How to start PowerShell from Windows Explorer

There are times when we need to start the Windows PowerShell inside the specific directory and start running the PowerShell commands. Usually, we type the command “PowerShell” in windows run to open PowerShell and then use the CD command to change the directory. This article explains How to start PowerShell from Windows Explorer.

Well, there are many ways to open the PowerShell from windows explorer. The different approaches are listed below.

How to start PowerShell from Windows Explorer

Approach 1: Using Windows Explorer Address Bar

In Windows Explorer, just go to the Address Bar at the top (keyboard shortcuts: Alt+D or Ctrl+L) and type powershell or powershell_ise and press Enter. A Powershell command window opens with the current directory.

Approach 2: Using Explorer menu option

If you’re on Windows 8, or later, you can simply use the built-in File -> “Open Windows Powershell”
Or Alt + F followed by R

Approach 3: Create a custom Context Menu option

As an alternative to the answer above, which requires you to type the PowerShell command (powershell.exe) each time, you can create a context menu entry just like with the “Open command window here” context menu.

There are three registry keys where these commands go. Each key controls the context menu of a different Windows Explorer object. The first one is the one you asked about:

  • HKCR\Directory\Background\shell – This is the context menu for the Explorer window itself (that is, the context menu that is displayed when no item is selected, such as when right-clicking in an empty area of the window).
  • HKCR\Directory\shell – This is the context menu of the folders in Windows Explorer.
  • HKCR\Drive\shell – This is the context menu for the drive icons in the root of Windows Explorer.

For each of these registry keys, you can add a subkey that will add an “Open PowerShell window here” command to the context menu, just as you have an “Open command window here” context menu.

Here is a copy of my OpenPowerShellHere.reg file, which puts the command in the context menu of each of the Explorer objects, the window background, the folder, and the drive icon:

Windows Registry Editor Version 5.00

;
; Add context menu entry to Windows Explorer background
;
[HKEY_CLASSES_ROOT\Directory\Background\shell\powershell]
@="Open PowerShell window here"
"NoWorkingDirectory"=""

[HKEY_CLASSES_ROOT\Directory\Background\shell\powershell\command]
@="C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe -NoExit -Command Set-Location -LiteralPath '%V'"

;
; Add context menu entry to Windows Explorer folders
;
[HKEY_CLASSES_ROOT\Directory\shell\powershell]
@="Open PowerShell window here"
"NoWorkingDirectory"=""

[HKEY_CLASSES_ROOT\Directory\shell\powershell\command]
@="C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe -NoExit -Command Set-Location -LiteralPath '%V'"

;
; Add context menu entry to Windows Explorer drive icons
;
[HKEY_CLASSES_ROOT\Drive\shell\powershell]
@="Open PowerShell window here"
"NoWorkingDirectory"=""

[HKEY_CLASSES_ROOT\Drive\shell\powershell\command]
@="C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe -NoExit -Command Set-Location -LiteralPath '%V'"

Save this into a file and name it as “PowerShell.reg”, double click on the file, when the prompt appears to add the registry key click on proceed.

Right-click on any folder after that and you will be able to see the option named “Open PowerShell Window here“.

Leave a Reply

Your email address will not be published. Required fields are marked *

Sign Up for Our Newsletters

Subscribe to get notified of the latest articles. We will never spam you. Be a part of our ever-growing community.

You May Also Like