Skip to content

Windows "previous versions" now opens pwsh.exe not explorer #6799

Closed

Description

@Jackbennett

Steps to reproduce

  1. Install the preview MSI
  2. Click Open at a shadow copy prior date;

image

Expected behavior

Windows explorer at this file path.

Actual behavior

pwsh.exe at path PS V:\@GMT-2018.04.23-10.11.03\ (of the time opened)

Work Around

I can just type start . to get explorer

Environment data

> $PSVersionTable
Name                           Value
----                           -----
PSVersion                      6.1.0-preview.2
PSEdition                      Core
GitCommitId                    v6.1.0-preview.2
OS                             Microsoft Windows 10.0.16299
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Activity

  1. GeeLaw commented on May 2, 2018

    @GeeLaw

    Did you mean installing the preview PowerShell somehow makes File Explorer think pwsh.exe is the shell program (which is usually explorer.exe)?

  2. Jackbennett commented on May 2, 2018

    @Jackbennett
    Author
  3. iSazonov commented on May 3, 2018

    @iSazonov
    Collaborator

    /cc Christoph Bergmeister (@bergmeister) Could you please comment?

  4. added
    WG-Maintainers-Build
    on May 3, 2018
  5. bergmeister commented on May 3, 2018

    @bergmeister
    Contributor

    On Windows 10 1803, when I click open on one of the previous versions of a library folder, then nothing happens at all, no matter if I have installed preview2, the latest preview or uninstall pwsh completely (but it works when opening e.g. a text file inside one of those folders)...
    This should not be related to the optional context menu that was added in 6.1 but it would be good to know whether the behaviour is different on your machine if you have have the explorer context menu option in the PowerShell installer enabled or not. I rather suspect some other program has changed your system. Does this behaviour stop happening if you uninstall the preview and install 6.0.2 instead Jack (@Jackbennett) ?
    Otherwise, just for the record: After 6.0.2, MSFT did some compliance refactoring of the installer but I was not involved in that.

  6. bergmeister commented on Oct 1, 2018

    @bergmeister
    Contributor

    Jack (@Jackbennett) Does this still happen with 6.1.0 in your environment?

  7. added
    Issue-Question
    on Oct 2, 2018
  8. Jackbennett commented on Oct 2, 2018

    @Jackbennett
    Author

    I'm afraid to report the same issue

    image

    Sorry it's been a while but on the up side this is completely re-imaged with MDT 1709 windows 10 x64 which was a fresh build from a microsoft ISO install from the initial report.

    Steps to reproduce

    1. Find a folder with previous versions
    2. Select "open" on an older folder version
    3. You will see explorer open at that point in time.
    4. Install PowerShell-6.1.0-win-x64.msi
    5. Click open again, You now get pwsh.exe at the previous version file path
    > $PsversionTable
    Name                           Value
    ----                           -----
    PSVersion                      6.1.0
    PSEdition                      Core
    GitCommitId                    6.1.0
    OS                             Microsoft Windows 10.0.16299
    Platform                       Win32NT
    PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
    PSRemotingProtocolVersion      2.3
    SerializationVersion           1.1.0.1
    WSManStackVersion              3.0
    

    Winver:
    image

  9. bergmeister commented on Oct 2, 2018

    @bergmeister
    Contributor

    Jack (@Jackbennett) Thanks for the detailed report. I suspect this might be related to #7815 that I started to investigate yesterday. I hope to have an answer in the next days. For the moment the recommendation is to re-install PowerShell without the context menu option if this is a blocking problem.

  10. Jackbennett commented on Oct 2, 2018

    @Jackbennett
    Author

    For completeness removed/installed without the context option ticked does indeed fix the issue. Interesting coincidence.

  11. bergmeister commented on Oct 2, 2018

    @bergmeister
    Contributor

    Thanks for confirming this (as it proves the problem is caused by this feature). I will investigate but there is a chance that this might even be a bug in Windows

  12. GeeLaw commented on Oct 2, 2018

    @GeeLaw

    Perhaps it is because PowerShell context menu assumed the default verb for folders?

  13. bergmeister commented on Oct 2, 2018

    @bergmeister
    Contributor

    Ji Luo (@GeeLaw) Where did you see that we assume the default verb for folders?
    I checked all the registry keys and could boil it down to the HKCR\Directory\shell\PowerShell6x64 entry and HKCR\Directory\ContextMenus\PowerShell6x64\shell\open, which is necessary for non-admin sub menu context menu.

  14. GeeLaw commented on Oct 2, 2018

    @GeeLaw

    Christoph Bergmeister (@bergmeister) Sorry, it isn't because PS6 assumes the default verb, it is because it takes the open verb -- the cascaded menu verb is named as open. If SEE_MASK_INVOKEIDLIST is used, this verb will be found by ShellExecuteEx, which is the case for "Open" in "Previous Versions".

    If you rename HKCR\Directory\ContextMenus\PowerShell6x64\shell\open to openpwsh, the problem will go away.

    Ordinarily, the open verb is found in HKLM\SOFTWARE\Classes\Folder\shell\open. PowerShell's context menu overrides this because it is found later than the should-be open.

    I'm writing a blog entry for a detailed analysis on this issue. Will be modifying this comment to reflect the entry later. Updated: here it is.

    It is also worth mentioning that currently the installer does not install on a per-user basis. The cascaded context menu will always be created for all users. As a piece of advice, the installer should be more specific on whether to install the keys to HKCU\Software\Classes or HKLM\SOFTWARE\Classes. Even if the installer is running as administrator, the value still might be written to HKCU\Software\Classes, if the key already exists in HKCU.

  15. bergmeister commented on Oct 3, 2018

    @bergmeister
    Contributor

    Ji Luo (@GeeLaw) Thanks for the detailed answer, I opened a pull request with a fix for the open verb to use openpwsh but I don't think we should change runas to runaspwsh due to the required elevation (and having a flickering launcher instead is not preferred instead, I proposed this already when I originally did the feature) because as far as I can see, continuing to use the default verb for runas should not cause a problem or is probably an edge case to be disregarded.

  16. JHBoricua commented on Mar 7, 2019

    @JHBoricua

    Has there been a regression of this? I just installed the latest Powershell Core MSI (PowerShell-6.1.3-win-x64) and it's opening the previous version of a folder in a powershell window. Uninstalling PowerShell core reverts the behavior back to normal.

    Or has something changed and this is the intended behavior now?

  17. bergmeister commented on Mar 7, 2019

    @bergmeister
    Contributor

    Jose A Hernandez (@JHBoricua) The fix was in https://github.com/PowerShell/PowerShell/pull/7932/files You can just check your registry entries. The fix was made after 6.1 was released, therefore it is very unlikely, the commit was included in one of the patches (which are mostly just for security critical patching of the runtime, etc.). Please try 6.2-rc

  18. kryptowastaken commented on Jan 11, 2024

    @kryptowastaken

    This problem is back in PowerShell 7 v7.3.7, the registry is correctly what it is supoosed to be but sill previous versions are opening in pwsh.exe when clicking the open button, however when double-clicking the folder itself, the previous version opens in File Explorer
    image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-QuestionResolution-DuplicateWG-Maintainers-Build

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions