How to exclude libraries from "Open with Powershell window" context menu

Jonathan Woodward 31 Reputation points
2021-04-25T17:10:26.723+00:00

The default "Open with Powershell window here" context menu entries in Win10 that appear when right-clicking a directory or directory background also appear when right-clicking the main library folder as well as specific library folders (documents, music, etc.) in the explorer navigation pane but the shell windows don't work, i.e. you cannot open a powershell window in a library.

Windows by default installs right-click context menu entries to launch a PowerShell window when right clicking a directory or directory background. The entries are installed in HKCU\Directory\shell and HKCU\Directory\Background\Shell. These entries work fine....meaning that when selecting Open PowerShell window upon right-clicking a directory, directory background or drive, a PowerShell window opens up to the desired directory.

However, these context menu entries are also present for Libraries, meaning that Open PowerShell Window Here exists for Libraries, but no shell can be opened for virtual folders and hardlinks. So PowerShell entries are not installed at HKCU\Library\Background\Shell, but, when right clicking the main library icon in File Explorer Navigation Pane, or the background of the main library virtual folder, a PowerShell context menu entry appears. When PowerShell is launched from the entry in a library, nothing happens. Note that, the PowerShell right-click entries for individual libraries, such as documents or pictures, have no PowerShell entries unless added to HKCR\Library\Background\shell

So, I would like to either: modify the context menu commands for PowerShell to open in libraries (which I don't think is possible for virtual folders) or exclude libraries, but not regular folders, from the registry entries.

How do I do this?

Windows for business Windows Client for IT Pros User experience Other
{count} votes

3 answers

Sort by: Most helpful
  1. Jonathan Woodward 31 Reputation points
    2021-05-14T14:37:39.53+00:00

    Can I please get an answer?

    0 comments No comments

  2. MotoX80 36,291 Reputation points
    2021-06-26T01:47:26.427+00:00

    Can I please get an answer? Why no response?

    I'll guess that you didn't get a response because other users are not seeing the same problem.

    My laptop was upgraded to win10 from win8 so that's not really a clean install. But I do have a clean install of a Win10 Pro VM that I use to play with stuff that I don't want to "corrupt" my main laptop with.

    If if right click on the white space in a directory, this is the menu I get.

    109532-capture.jpg

    If I right click on a .txt file, this is the menu that I get.

    109440-capture1.jpg

    If I right click on a .ps1 file, this is the menu that I get. I have "Run with Powershell", but I do not have "Open with Powershell window here".

    109450-capture2.jpg

    Based on this link, it might depend on what version of Win10 that you start with.

    https://www.tenforums.com/tutorials/60175-open-powershell-window-here-context-menu-add-windows-10-a.html.

    Try the "23 To Remove 'Open PowerShell window here' Context Menu instructions."

    Update: maybe try some of the free context menu editors.

    https://www.thewindowsclub.com/remove-click-context-menu-items-editors

    0 comments No comments

  3. Jonathan Woodward 31 Reputation points
    2021-08-13T18:23:14.32+00:00

    I never found a solution. MS by default adds either shift+right click "Open With Command Prompt here" or "Open with PowerShell Window here" to the main libraries icon in the navigation pane of explorer as well as the main libraries background explorer. Launching the shells in these locations does nothing, i.e. no command or powershell window opens. I don't think there is a solution.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.